Page MenuHomeSoftware Heritage

D1295.id.diff
No OneTemporary

D1295.id.diff

diff --git a/swh/web/assets/src/bundles/browse/origin-search.js b/swh/web/assets/src/bundles/browse/origin-search.js
--- a/swh/web/assets/src/bundles/browse/origin-search.js
+++ b/swh/web/assets/src/bundles/browse/origin-search.js
@@ -97,10 +97,16 @@
for (let i = 0; i < patternsArray.length; ++i) {
patternsArray[i] = escapeStringRegexp(patternsArray[i]);
}
- let patternsPermut = [];
- heapsPermute(patternsArray, p => patternsPermut.push(p.join('.*')));
- let regex = patternsPermut.join('|');
- baseSearchUrl = Urls.browse_origin_search(regex) + `?regexp=true`;
+ // url length must be less than 4096 for modern browsers
+ // assuming average word length, 6 is max patternArray.length
+ if (patternsArray.length < 7) {
+ let patternsPermut = [];
+ heapsPermute(patternsArray, p => patternsPermut.push(p.join('.*')));
+ let regex = patternsPermut.join('|');
+ baseSearchUrl = Urls.browse_origin_search(regex) + `?regexp=true`;
+ } else {
+ baseSearchUrl = Urls.browse_origin_search(patternsArray.join('.*')) + `?regexp=true`;
+ }
}
let withVisit = $('#swh-search-origins-with-visit').prop('checked');

File Metadata

Mime Type
text/plain
Expires
Nov 5 2024, 6:19 AM (8 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3218451

Event Timeline