Skip to content

Commit

Permalink
[FILES] Bad request with no path when calling drive without slash (#1366
Browse files Browse the repository at this point in the history
)

* fix

* lingui extract

Co-authored-by: Michael Yankelev <12774278+FSM1@users.noreply.github.com>
Co-authored-by: GitHub Actions <actions@github.com>
  • Loading branch information
3 people authored Jul 29, 2021
1 parent 0a72941 commit e072513
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/files-ui/src/Utils/pathUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ export function getParentPathFromFilePath(filePath: string) {
}

// /drive/path/to/somewhere -> /path/to/somewhere
// /drive -> /
export function extractFileBrowserPathFromURL(browserUrl: string, modulePath: string) {
return browserUrl.replace(modulePath, "").split("/").map(decodeURIComponent).join("/")
const result = browserUrl.replace(modulePath, "").split("/").map(decodeURIComponent).join("/")
// this path must start by a /
return result[0] === "/" ? result : `/${result}`
}

// /shared/{bucket-id}/path/to/somewhere -> /path/to/somewhere
Expand Down

0 comments on commit e072513

Please sign in to comment.