Skip to content

Commit 59a1eff

Browse files
committed
Skohub: Fix for scheme URIs that end with slash (#29)
1 parent 9a95c23 commit 59a1eff

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/providers/skohub-provider.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ export default class SkohubProvider extends BaseProvider {
6767
return scheme
6868
}
6969

70-
const data = await this.axios({ ...config, url: `${uri}.json` })
70+
let postfix = ".json"
71+
if (uri.endsWith("/")) {
72+
postfix = "index.json"
73+
}
74+
const data = await this.axios({ ...config, url: `${uri}${postfix}` })
7175

7276
// TODO: if not found
7377

@@ -203,7 +207,11 @@ export default class SkohubProvider extends BaseProvider {
203207
break
204208
}
205209
try {
206-
const { data } = await axios.get(`${scheme.uri}.${lang}.index`)
210+
let postfix = ".index"
211+
if (scheme.uri.endsWith("/")) {
212+
postfix = "index.index"
213+
}
214+
const { data } = await axios.get(`${scheme.uri}.${lang}${postfix}`)
207215
index = FlexSearch.create()
208216
index.import(data)
209217
this._index[scheme.uri][lang] = index

0 commit comments

Comments
 (0)