diff --git a/gui/default/assets/lang/lang-en.json b/gui/default/assets/lang/lang-en.json index 33d379f58..dbf2944c5 100644 --- a/gui/default/assets/lang/lang-en.json +++ b/gui/default/assets/lang/lang-en.json @@ -94,6 +94,7 @@ "Error": "Error", "External File Versioning": "External File Versioning", "Failed Items": "Failed Items", + "Failed to load ignore patterns": "Failed to load ignore patterns", "Failed to setup, retrying": "Failed to setup, retrying", "Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.": "Failure to connect to IPv6 servers is expected if there is no IPv6 connectivity.", "File Pull Order": "File Pull Order", diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 22e239e2b..3ee265ddf 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -2,7 +2,7 @@ angular.module('syncthing.core') .config(function($locationProvider) { $locationProvider.html5Mode({enabled: true, requireBase: false}).hashPrefix('!'); }) - .controller('SyncthingController', function ($scope, $http, $location, LocaleService, Events, $filter, $q, $compile, $timeout, $rootScope) { + .controller('SyncthingController', function ($scope, $http, $location, LocaleService, Events, $filter, $q, $compile, $timeout, $rootScope, $translate) { 'use strict'; // private/helper definitions @@ -715,7 +715,6 @@ angular.module('syncthing.core') $http.get(urlbase + "/events/disk?limit=25").success(function (data) { data = data.reverse(); $scope.globalChangeEvents = data; - console.log("refreshGlobalChanges", data); }).error($scope.emitHTTPError); }, 2500); @@ -1580,15 +1579,17 @@ angular.module('syncthing.core') } $scope.currentFolder.externalCommand = $scope.currentFolder.externalCommand || ""; - $('#folder-ignores textarea').val(""); + $('#folder-ignores textarea').val($translate.instant("Loading...")); $('#folder-ignores textarea').attr('disabled', 'disabled'); $http.get(urlbase + '/db/ignores?folder=' + encodeURIComponent($scope.currentFolder.id)) .success(function (data) { $scope.currentFolder.ignores = data.ignore || []; $('#folder-ignores textarea').val($scope.currentFolder.ignores.join('\n')); - }) - .then(function () { $('#folder-ignores textarea').removeAttr('disabled'); + }) + .error(function (err) { + $('#folder-ignores textarea').val($translate.instant("Failed to load ignore patterns.")); + $scope.emitHTTPError(err); }); $scope.editFolderModal(); @@ -1711,7 +1712,6 @@ angular.module('syncthing.core') }); } }); - }; $scope.dismissFolderRejection = function (folder, device) { diff --git a/lib/config/config_test.go b/lib/config/config_test.go index ee7913f63..73cebd702 100644 --- a/lib/config/config_test.go +++ b/lib/config/config_test.go @@ -436,11 +436,11 @@ func TestFolderCheckPath(t *testing.T) { }{ { path: "", - err: errMarkerMissing, + err: ErrMarkerMissing, }, { path: "does not exist", - err: errPathMissing, + err: ErrPathMissing, }, { path: "dir", diff --git a/lib/config/folderconfiguration.go b/lib/config/folderconfiguration.go index 6d8f9ef4b..bb38650ce 100644 --- a/lib/config/folderconfiguration.go +++ b/lib/config/folderconfiguration.go @@ -18,9 +18,9 @@ import ( ) var ( - errPathNotDirectory = errors.New("folder path not a directory") - errPathMissing = errors.New("folder path missing") - errMarkerMissing = errors.New("folder marker missing") + ErrPathNotDirectory = errors.New("folder path not a directory") + ErrPathMissing = errors.New("folder path missing") + ErrMarkerMissing = errors.New("folder marker missing") ) const DefaultMarkerName = ".stfolder" @@ -113,7 +113,7 @@ func (f FolderConfiguration) Versioner() versioner.Versioner { } func (f *FolderConfiguration) CreateMarker() error { - if err := f.CheckPath(); err != errMarkerMissing { + if err := f.CheckPath(); err != ErrMarkerMissing { return err } if f.MarkerName != DefaultMarkerName { @@ -151,7 +151,7 @@ func (f *FolderConfiguration) CheckPath() error { if !fs.IsNotExist(err) { return err } - return errPathMissing + return ErrPathMissing } // Users might have the root directory as a symlink or reparse point. @@ -161,7 +161,7 @@ func (f *FolderConfiguration) CheckPath() error { // Stat ends up calling stat on C:\dir\file\ which, fails with "is not a directory" // in the error check above, and we don't even get to here. if !fi.IsDir() && !fi.IsSymlink() { - return errPathNotDirectory + return ErrPathNotDirectory } _, err = f.Filesystem().Stat(f.MarkerName) @@ -169,7 +169,7 @@ func (f *FolderConfiguration) CheckPath() error { if !fs.IsNotExist(err) { return err } - return errMarkerMissing + return ErrMarkerMissing } return nil diff --git a/lib/model/model.go b/lib/model/model.go index 3b4a5c74c..6f5f150e7 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -1428,7 +1428,8 @@ func (m *Model) GetIgnores(folder string) ([]string, []string, error) { } } - if err := cfg.CheckPath(); err != nil { + // On creation a new folder with ignore patterns validly has no marker yet. + if err := cfg.CheckPath(); err != nil && err != config.ErrMarkerMissing { return nil, nil, err }