From 241d731e4b6b94d9e6b3f86ee20a5ac3f307bf8a Mon Sep 17 00:00:00 2001
From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr>
Date: Wed, 1 Mar 2023 18:26:05 +0100
Subject: [PATCH] Revert "Revert "Disable searching manifest in annotation
 content""

This reverts commit ec328a33355caae6ce3459f9c29cdfc6b38a1c2a.
---
 src/components/AnnotationManifestsAccordion.js | 16 +---------------
 src/helper/utils.js                            |  6 ------
 2 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/src/components/AnnotationManifestsAccordion.js b/src/components/AnnotationManifestsAccordion.js
index 5287697ca..95cb2f11e 100644
--- a/src/components/AnnotationManifestsAccordion.js
+++ b/src/components/AnnotationManifestsAccordion.js
@@ -24,16 +24,6 @@ export class AnnotationManifestsAccordion extends Component {
     this.handleOpenManifestSideToSide = this.handleOpenManifestSideToSide.bind(this);
     this.handleOpenAccordion = this.handleOpenAccordion.bind(this);
 
-    /** Search manifest directly in content. We consider all the links with #manifest at the end are manifest */
-    function searchManifestInContent(text) {
-      if (text == null) {
-        return null;
-      }
-      return text.match(
-        /((http|https)\:\/\/[a-z0-9\/:%_+.,#?!@&=-]+)#manifest/gi,
-      );
-    }
-
     /** Search if the annotation is a manifest. URL must be resolvable for the annotation. So the manifest url is added at the end of the id */
     function searchManifestInID(id) {
       const match = id.match(
@@ -45,17 +35,13 @@ export class AnnotationManifestsAccordion extends Component {
 
     const { annotation } = this.props;
 
-    /** Merge array even if some are null) */
-    const concat = (...arrays) => [].concat(...arrays.filter(Array.isArray));
-
-    annotation.manifests = concat(searchManifestInContent(annotation.content), searchManifestInID(annotation.id));
+    annotation.manifests = searchManifestInID(annotation.id);
     if (annotation.manifests) {
       annotation.manifests = annotation.manifests.map(id => ({ id }));
     } else {
       annotation.manifests = [];
     }
 
-    annotation.manifests = removeDuplicates(annotation.manifests);
     this.state = { annotation };
   }
 
diff --git a/src/helper/utils.js b/src/helper/utils.js
index c0b88adc3..a39f2b31a 100644
--- a/src/helper/utils.js
+++ b/src/helper/utils.js
@@ -1,9 +1,3 @@
-/**
- * Remove duplicate elements in array
- *
- * */
-export const removeDuplicates = (arr) => [...new Map(arr.map(v => [v.id, v])).values()];
-
 /**
  * Filter annotation with a query string. Search in ID and value
  * */
-- 
GitLab