Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
test: encodeURL
Browse files Browse the repository at this point in the history
  • Loading branch information
LufsX committed Oct 3, 2020
1 parent a16c4cf commit c671cc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/files/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function handleFile(request, pathname, downloadUrl, { proxied = fal
}

export async function handleUpload(request, pathname, filename) {
const url = `https://graph.microsoft.com/v1.0/me/drive/root:${config.base +
const url = `https://graph.microsoft.com/v1.0/me/drive/root:${encodeURI(config.base) +
(pathname.slice(-1) === '/' ? pathname : pathname + '/')}${filename}:/content`
return await fetch(url, {
method: 'PUT',
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const cache = caches.default
* @param {string} pathname The absolute path to file
*/
function wrapPathName(pathname) {
pathname = config.base + (pathname === '/' ? '' : pathname)
pathname = encodeURI(config.base) + (pathname === '/' ? '' : pathname)
return pathname === '/' || pathname === '' ? '' : ':' + pathname
}

Expand All @@ -45,7 +45,7 @@ async function handleRequest(request) {
if (maybeResponse) return maybeResponse
}

const base = config.base
const base = encodeURI(config.base)
const accessToken = await getAccessToken()

const { pathname, searchParams } = new URL(request.url)
Expand Down

0 comments on commit c671cc5

Please sign in to comment.