Skip to content

Commit

Permalink
Skohub: Fix for scheme URIs that end with slash (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed Jun 21, 2022
1 parent 9a95c23 commit 59a1eff
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/providers/skohub-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ export default class SkohubProvider extends BaseProvider {
return scheme
}

const data = await this.axios({ ...config, url: `${uri}.json` })
let postfix = ".json"
if (uri.endsWith("/")) {
postfix = "index.json"
}
const data = await this.axios({ ...config, url: `${uri}${postfix}` })

// TODO: if not found

Expand Down Expand Up @@ -203,7 +207,11 @@ export default class SkohubProvider extends BaseProvider {
break
}
try {
const { data } = await axios.get(`${scheme.uri}.${lang}.index`)
let postfix = ".index"
if (scheme.uri.endsWith("/")) {
postfix = "index.index"
}
const { data } = await axios.get(`${scheme.uri}.${lang}${postfix}`)
index = FlexSearch.create()
index.import(data)
this._index[scheme.uri][lang] = index
Expand Down

0 comments on commit 59a1eff

Please sign in to comment.