Skip to content

Commit bd0d278

Browse files
committed
Propagate drive output change to "shared with me" output, if applicable
Signed-off-by: Severin Hamader <severin.hamader@yahoo.de>
1 parent 216c3ca commit bd0d278

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

src/components/PersonalSettings.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,27 @@ export default {
684684
if (targetPath === '') {
685685
targetPath = '/'
686686
}
687+
const oldPath = this.state.drive_output_dir
687688
this.state.drive_output_dir = targetPath
688-
this.saveOptions({ drive_output_dir: this.state.drive_output_dir }, (response) => {
689+
const options = { drive_output_dir: this.state.drive_output_dir }
690+
691+
if (this.state.drive_shared_with_me_output_dir.startsWith(oldPath)) {
692+
let sharedWithMeFolder = this.state.drive_shared_with_me_output_dir.replace(oldPath, '')
693+
if (sharedWithMeFolder.length > 0) {
694+
if (this.state.drive_output_dir.endsWith('/')) {
695+
// drop the leading slash in case the new path ends already with a slash (e.g. root)
696+
sharedWithMeFolder = sharedWithMeFolder.substring(1)
697+
} else if (!sharedWithMeFolder.startsWith('/')) {
698+
// add a leading slash in case the old path ended with a slash (e.g. root)
699+
sharedWithMeFolder = '/' + sharedWithMeFolder
700+
}
701+
702+
this.state.drive_shared_with_me_output_dir = this.state.drive_output_dir + sharedWithMeFolder
703+
options.drive_shared_with_me_output_dir = this.state.drive_shared_with_me_output_dir
704+
}
705+
}
706+
707+
this.saveOptions(options, (response) => {
689708
if (response.data && response.data.free_space) {
690709
this.state.free_space = response.data.free_space
691710
}

0 commit comments

Comments
 (0)