gui: Remove tilde auto-expansions (fixes #8890) (#8954)

This removes the tilde expansion we had in the GUI. I'm not sure why we
had it, but there are valid reasons to have a folder path with tilde in
it in the config, and it was previously impossible to enter one of
those.
This commit is contained in:
Jakob Borg 2023-06-28 07:03:53 +02:00 committed by GitHub
parent b99dee3ac3
commit a4a1231e92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -740,20 +740,12 @@ angular.module('syncthing.core')
} }
function pathJoin(base, name) { function pathJoin(base, name) {
base = expandTilde(base);
if (base[base.length - 1] !== $scope.system.pathSeparator) { if (base[base.length - 1] !== $scope.system.pathSeparator) {
return base + $scope.system.pathSeparator + name; return base + $scope.system.pathSeparator + name;
} }
return base + name; return base + name;
} }
function expandTilde(path) {
if (path && path.trim().charAt(0) === '~') {
return $scope.system.tilde + path.trim().substring(1);
}
return path;
}
function shouldSetDefaultFolderPath() { function shouldSetDefaultFolderPath() {
return $scope.config.defaults.folder.path && $scope.folderEditor.folderPath.$pristine && $scope.editingFolderNew(); return $scope.config.defaults.folder.path && $scope.folderEditor.folderPath.$pristine && $scope.editingFolderNew();
} }
@ -1988,7 +1980,7 @@ angular.module('syncthing.core')
if (!newvalue) { if (!newvalue) {
return; return;
} }
$scope.currentFolder.path = expandTilde(newvalue); $scope.currentFolder.path = newvalue;
$http.get(urlbase + '/system/browse', { $http.get(urlbase + '/system/browse', {
params: { current: newvalue } params: { current: newvalue }
}).success(function (data) { }).success(function (data) {