Skip to content

Commit

Permalink
fix: Display full URI if prefix is not known (closes #4)
Browse files Browse the repository at this point in the history
  • Loading branch information
smessie committed Nov 9, 2023
1 parent 20b89e9 commit daa5804
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/ScholarlyBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ export default {
const response = await fetch(`https://prefixcc-proxy.smessie.com/?q=${encodeURIComponent(property)}`, {
method: 'HEAD',
});
// Check if a redirect happened.
if (response.url.includes(`/?q=${encodeURIComponent(property)}`)) {
// No redirect happened, so the prefix is not known.
return property;
}
// Now get the prefix from the URL of the response.
return response.url.split('prefixcc-proxy.smessie.com/')[1];
},
Expand Down

0 comments on commit daa5804

Please sign in to comment.