fix: encoded file path on share

This commit is contained in:
Ramires Viana
2021-03-12 15:15:56 +00:00
parent e017a19985
commit 7955e0720b
3 changed files with 48 additions and 31 deletions

View File

@@ -33,12 +33,8 @@ export async function fetchJSON (url, opts) {
}
}
export function removePrefix (url, prefix) {
if (url.startsWith('/files')) {
url = url.slice(6)
} else if (prefix) {
url = url.replace(prefix, '')
}
export function removePrefix (url) {
url = url.split('/').splice(2).join('/')
if (url === '') url = '/'
if (url[0] !== '/') url = '/' + url