Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to specify the root of an upload #1131

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

skjnldsv
Copy link
Contributor

@skjnldsv skjnldsv commented Apr 2, 2024

This allow us to not have to change the current uploader destination.
Needed for nextcloud/server#44409

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv skjnldsv requested a review from susnux April 2, 2024 09:32
@skjnldsv skjnldsv self-assigned this Apr 2, 2024
@skjnldsv skjnldsv added 3. to review Waiting for reviews technical debt Technical issue labels Apr 2, 2024
@skjnldsv skjnldsv requested review from Pytal and emoral435 April 2, 2024 10:40
@skjnldsv skjnldsv enabled auto-merge April 2, 2024 11:13
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(/^\//, '')}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it makes sense to do so, but this would also allow an empty root:

Suggested change
const destinationFile = `${root || this.root}/${destinationPath.replace(/^\//, '')}`
const destinationFile = `${root ?? this.root}/${destinationPath.replace(/^\//, '')}`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, we should probably not allow empty root 👍

Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good feature!

@skjnldsv skjnldsv merged commit 7f6b33b into main Apr 2, 2024
15 checks passed
@skjnldsv skjnldsv deleted the feat/upload-override-root branch April 2, 2024 11:50
@skjnldsv skjnldsv mentioned this pull request Apr 2, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews technical debt Technical issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants