Skip to content

Commit

Permalink
Merge pull request #1131 from nextcloud-libraries/feat/upload-overrid…
Browse files Browse the repository at this point in the history
…e-root
  • Loading branch information
skjnldsv authored Apr 2, 2024
2 parents 72e94ad + 1e5358d commit 7f6b33b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,10 @@ export class Uploader {
* Upload a file to the given path
* @param {string} destinationPath the destination path relative to the root folder. e.g. /foo/bar.txt
* @param {File} file the file to upload
* @param {string} root the root folder to upload to
*/
upload(destinationPath: string, file: File): PCancelable<Upload> {
const destinationFile = `${this.root}/${destinationPath.replace(/^\//, '')}`
upload(destinationPath: string, file: File, root?: string): PCancelable<Upload> {
const destinationFile = `${root || this.root}/${destinationPath.replace(/^\//, '')}`

// Get the encoded source url to this object for requests purposes
const { origin } = new URL(destinationFile)
Expand Down

0 comments on commit 7f6b33b

Please sign in to comment.