File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments