mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Fixing sub directory search issue
(it was failing on directory:(dir/subdir) due to the "/" in the url) #284
This commit is contained in:
parent
8b3f6ac64d
commit
c5a1fa2657
@ -33,7 +33,7 @@
|
||||
"url": "https://github.com/bpatrik/PiGallery2/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"archiver": "^5.3.0",
|
||||
"archiver": "5.3.0",
|
||||
"bcrypt": "5.0.1",
|
||||
"body-parser": "1.19.0",
|
||||
"cookie-parser": "1.4.5",
|
||||
@ -78,7 +78,7 @@
|
||||
"@asymmetrik/ngx-leaflet": "8.1.0",
|
||||
"@asymmetrik/ngx-leaflet-markercluster": "5.0.1",
|
||||
"@ngx-loading-bar/core": "5.1.1",
|
||||
"@types/archiver": "^5.1.0",
|
||||
"@types/archiver": "5.1.0",
|
||||
"@types/bcrypt": "3.0.1",
|
||||
"@types/bcryptjs": "2.4.2",
|
||||
"@types/chai": "4.2.16",
|
||||
@ -126,7 +126,7 @@
|
||||
"karma-jasmine-html-reporter": "1.5.4",
|
||||
"karma-remap-istanbul": "0.6.0",
|
||||
"karma-systemjs": "0.16.0",
|
||||
"leaflet": "^1.7.1",
|
||||
"leaflet": "1.7.1",
|
||||
"leaflet.markercluster": "1.5.0",
|
||||
"mocha": "8.3.2",
|
||||
"natural-orderby": "2.0.3",
|
||||
|
@ -196,7 +196,7 @@ export class GalleryRouter {
|
||||
}
|
||||
|
||||
protected static addSearch(app: Express): void {
|
||||
app.get('/api/search/:searchQueryDTO',
|
||||
app.get('/api/search/:searchQueryDTO(*)',
|
||||
// common part
|
||||
AuthenticationMWs.authenticate,
|
||||
AuthenticationMWs.authorise(UserRoles.Guest),
|
||||
@ -212,7 +212,7 @@ export class GalleryRouter {
|
||||
|
||||
|
||||
protected static addAutoComplete(app: Express): void {
|
||||
app.get('/api/autocomplete/:text',
|
||||
app.get('/api/autocomplete/:text(*)',
|
||||
// common part
|
||||
AuthenticationMWs.authenticate,
|
||||
AuthenticationMWs.authorise(UserRoles.Guest),
|
||||
|
@ -68,17 +68,21 @@ export class AutoCompleteService {
|
||||
items = items || new BehaviorSubject([]);
|
||||
|
||||
const cached = this.galleryCacheService.getAutoComplete(text, type);
|
||||
if (cached == null) {
|
||||
const acParams: any = {};
|
||||
if (type) {
|
||||
acParams[QueryParams.gallery.search.type] = type;
|
||||
try {
|
||||
if (cached == null) {
|
||||
const acParams: any = {};
|
||||
if (type) {
|
||||
acParams[QueryParams.gallery.search.type] = type;
|
||||
}
|
||||
this.networkService.getJson<IAutoCompleteItem[]>('/autocomplete/' + text, acParams).then(ret => {
|
||||
this.galleryCacheService.setAutoComplete(text, type, ret);
|
||||
items.next(this.sortResults(text, ret.map(i => this.ACItemToRenderable(i, fullText)).concat(items.value)));
|
||||
});
|
||||
} else {
|
||||
items.next(this.sortResults(text, cached.map(i => this.ACItemToRenderable(i, fullText)).concat(items.value)));
|
||||
}
|
||||
this.networkService.getJson<IAutoCompleteItem[]>('/autocomplete/' + text, acParams).then(ret => {
|
||||
this.galleryCacheService.setAutoComplete(text, type, ret);
|
||||
items.next(this.sortResults(text, ret.map(i => this.ACItemToRenderable(i, fullText)).concat(items.value)));
|
||||
});
|
||||
} else {
|
||||
items.next(this.sortResults(text, cached.map(i => this.ACItemToRenderable(i, fullText)).concat(items.value)));
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user