diff options
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/js/app.js | 3 | ||||
-rw-r--r-- | apps/files_external/js/mountsfilelist.js | 2 | ||||
-rw-r--r-- | apps/files_external/l10n/es.js | 2 | ||||
-rw-r--r-- | apps/files_external/l10n/es.json | 2 | ||||
-rw-r--r-- | apps/files_external/l10n/es_MX.js | 2 | ||||
-rw-r--r-- | apps/files_external/l10n/es_MX.json | 2 | ||||
-rw-r--r-- | apps/files_external/l10n/ja.js | 2 | ||||
-rw-r--r-- | apps/files_external/l10n/ja.json | 2 | ||||
-rw-r--r-- | apps/files_external/l10n/ko.js | 12 | ||||
-rw-r--r-- | apps/files_external/l10n/ko.json | 12 | ||||
-rw-r--r-- | apps/files_external/l10n/pt_BR.js | 14 | ||||
-rw-r--r-- | apps/files_external/l10n/pt_BR.json | 14 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 70 | ||||
-rw-r--r-- | apps/files_external/templates/settings.php | 2 | ||||
-rw-r--r-- | apps/files_external/tests/Storage/SmbTest.php | 19 |
15 files changed, 112 insertions, 48 deletions
diff --git a/apps/files_external/js/app.js b/apps/files_external/js/app.js index d3ce2010ecd..859a820f14c 100644 --- a/apps/files_external/js/app.js +++ b/apps/files_external/js/app.js @@ -35,7 +35,7 @@ OCA.External.App = { ); this._extendFileList(this.fileList); - this.fileList.appName = t('files_external', 'External storage'); + this.fileList.appName = t('files_external', 'External storages'); return this.fileList; }, @@ -111,4 +111,3 @@ $(document).ready(function() { } /* End Status Manager */ }); - diff --git a/apps/files_external/js/mountsfilelist.js b/apps/files_external/js/mountsfilelist.js index 35aef751fef..3beee6f73b2 100644 --- a/apps/files_external/js/mountsfilelist.js +++ b/apps/files_external/js/mountsfilelist.js @@ -28,7 +28,7 @@ FileList.prototype = _.extend({}, OCA.Files.FileList.prototype, /** @lends OCA.External.FileList.prototype */ { - appName: 'External storage', + appName: 'External storages', /** * @private diff --git a/apps/files_external/l10n/es.js b/apps/files_external/l10n/es.js index 91a0abcf988..97e0c9248a7 100644 --- a/apps/files_external/l10n/es.js +++ b/apps/files_external/l10n/es.js @@ -39,6 +39,7 @@ OC.L10N.register( "Credentials saved" : "Credenciales guardados", "Credentials saving failed" : "Guardado de credenciales fallido", "Credentials required" : "Credenciales requeridos", + "Storage with ID \"%d\" not found" : "No se ha encontrado el almacenamiento con ID \"%d\"", "Invalid backend or authentication mechanism class" : "Sistema o mecanismo de autentificación inválido", "Invalid mount point" : "Punto de montaje no válido", "Objectstore forbidden" : "Objeto de almacenaje prohibido", @@ -49,6 +50,7 @@ OC.L10N.register( "Unsatisfied authentication mechanism parameters" : "Los parámetros del mecanismo de autentificación no son válidos", "Insufficient data: %s" : "Datos insuficientes: %s", "%s" : "%s", + "Storage with ID \"%d\" is not user editable" : "El almacenamiento con ID \"%d\" no se puede editar por el usuario", "Access key" : "Clave de acceso", "Secret key" : "Clave secreta", "Builtin" : "Incorporado", diff --git a/apps/files_external/l10n/es.json b/apps/files_external/l10n/es.json index ce2532a02cc..67024b59979 100644 --- a/apps/files_external/l10n/es.json +++ b/apps/files_external/l10n/es.json @@ -37,6 +37,7 @@ "Credentials saved" : "Credenciales guardados", "Credentials saving failed" : "Guardado de credenciales fallido", "Credentials required" : "Credenciales requeridos", + "Storage with ID \"%d\" not found" : "No se ha encontrado el almacenamiento con ID \"%d\"", "Invalid backend or authentication mechanism class" : "Sistema o mecanismo de autentificación inválido", "Invalid mount point" : "Punto de montaje no válido", "Objectstore forbidden" : "Objeto de almacenaje prohibido", @@ -47,6 +48,7 @@ "Unsatisfied authentication mechanism parameters" : "Los parámetros del mecanismo de autentificación no son válidos", "Insufficient data: %s" : "Datos insuficientes: %s", "%s" : "%s", + "Storage with ID \"%d\" is not user editable" : "El almacenamiento con ID \"%d\" no se puede editar por el usuario", "Access key" : "Clave de acceso", "Secret key" : "Clave secreta", "Builtin" : "Incorporado", diff --git a/apps/files_external/l10n/es_MX.js b/apps/files_external/l10n/es_MX.js index c25448eda80..e16eaae639e 100644 --- a/apps/files_external/l10n/es_MX.js +++ b/apps/files_external/l10n/es_MX.js @@ -112,7 +112,7 @@ OC.L10N.register( "Storage type" : "Tipo de almacenamiento", "Scope" : "Alcance", "Enable encryption" : "Habilitar encripción", - "Enable previews" : "Habilitar previsualizaciones", + "Enable previews" : "Habilitar vistas previas", "Enable sharing" : "Habilitar compartir", "Check for changes" : "Verificar si hay cambios", "Never" : "Nunca", diff --git a/apps/files_external/l10n/es_MX.json b/apps/files_external/l10n/es_MX.json index 9f3a451349e..0d82a5723ce 100644 --- a/apps/files_external/l10n/es_MX.json +++ b/apps/files_external/l10n/es_MX.json @@ -110,7 +110,7 @@ "Storage type" : "Tipo de almacenamiento", "Scope" : "Alcance", "Enable encryption" : "Habilitar encripción", - "Enable previews" : "Habilitar previsualizaciones", + "Enable previews" : "Habilitar vistas previas", "Enable sharing" : "Habilitar compartir", "Check for changes" : "Verificar si hay cambios", "Never" : "Nunca", diff --git a/apps/files_external/l10n/ja.js b/apps/files_external/l10n/ja.js index 0223d60fc64..60c40e2723a 100644 --- a/apps/files_external/l10n/ja.js +++ b/apps/files_external/l10n/ja.js @@ -39,6 +39,7 @@ OC.L10N.register( "Credentials saved" : "資格情報を保存しました", "Credentials saving failed" : "資格情報の保存に失敗しました", "Credentials required" : "資格情報が必要です", + "Storage with ID \"%d\" not found" : "ID \"%d\" のストレージが見つかりません", "Invalid backend or authentication mechanism class" : "バックエンドまたは認証システムクラスが無効", "Invalid mount point" : "無効なマウントポイント", "Objectstore forbidden" : "オブジェクトストアが禁じられています", @@ -49,6 +50,7 @@ OC.L10N.register( "Unsatisfied authentication mechanism parameters" : "認証のためのパラメータが不十分です", "Insufficient data: %s" : "データが不足しています: %s", "%s" : "%s", + "Storage with ID \"%d\" is not user editable" : "ID \"%d\" のストレージはユーザーが編集できません", "Access key" : "アクセスキー", "Secret key" : "シークレットキー", "Builtin" : "ビルトイン", diff --git a/apps/files_external/l10n/ja.json b/apps/files_external/l10n/ja.json index b80c3f3fddc..7b5d9857508 100644 --- a/apps/files_external/l10n/ja.json +++ b/apps/files_external/l10n/ja.json @@ -37,6 +37,7 @@ "Credentials saved" : "資格情報を保存しました", "Credentials saving failed" : "資格情報の保存に失敗しました", "Credentials required" : "資格情報が必要です", + "Storage with ID \"%d\" not found" : "ID \"%d\" のストレージが見つかりません", "Invalid backend or authentication mechanism class" : "バックエンドまたは認証システムクラスが無効", "Invalid mount point" : "無効なマウントポイント", "Objectstore forbidden" : "オブジェクトストアが禁じられています", @@ -47,6 +48,7 @@ "Unsatisfied authentication mechanism parameters" : "認証のためのパラメータが不十分です", "Insufficient data: %s" : "データが不足しています: %s", "%s" : "%s", + "Storage with ID \"%d\" is not user editable" : "ID \"%d\" のストレージはユーザーが編集できません", "Access key" : "アクセスキー", "Secret key" : "シークレットキー", "Builtin" : "ビルトイン", diff --git a/apps/files_external/l10n/ko.js b/apps/files_external/l10n/ko.js index ac0a4dda076..87e8e454aeb 100644 --- a/apps/files_external/l10n/ko.js +++ b/apps/files_external/l10n/ko.js @@ -9,7 +9,7 @@ OC.L10N.register( "External storages" : "외부 저장소", "External storage" : "외부 저장소", "Dropbox App Configuration" : "Dropbox 앱 설정", - "Google Drive App Configuration" : "구글 드라이브 앱 설정", + "Google Drive App Configuration" : "Google 드라이브 앱 설정", "Personal" : "개인", "System" : "시스템", "Grant access" : "접근 권한 부여", @@ -17,13 +17,16 @@ OC.L10N.register( "Error configuring OAuth2" : "OAuth2 설정 오류", "Generate keys" : "키 생성", "Error generating key pair" : "키 쌍을 생성하는 중 오류 발생", - "All users. Type to select user or group." : "모든 사용자입니다. 사용자나 그룹을 선택하려면 입력하십시오", + "All users. Type to select user or group." : "모든 사용자입니다. 사용자나 그룹을 선택하려면 입력하십시오.", "(group)" : "(그룹)", + "Compatibility with Mac NFD encoding (slow)" : "Mac NFD 인코딩 호환성 사용(느림)", "Admin defined" : "관리자 지정", "Saved" : "저장됨", + "Saving..." : "저장 중...", "Save" : "저장", "Empty response from the server" : "서버에서 빈 응답이 돌아옴", "Couldn't access. Please logout and login to activate this mount point" : "접근할 수 없습니다. 이 마운트 지점을 활성화하려면 로그아웃 후 로그인하십시오", + "Couldn't get the information from the remote server: {code} {type}" : "원격 서버에서 정보를 가져올 수 없음: {code} {type}", "Couldn't get the list of external mount points: {type}" : "외부 마운트 지점 목록을 가져올 수 없음: {type}", "There was an error with message: " : "오류 메시지: ", "External mount error" : "외부 마운트 오류", @@ -36,6 +39,7 @@ OC.L10N.register( "Credentials saved" : "인증 정보 저장됨", "Credentials saving failed" : "인증 정보를 저장할 수 없음", "Credentials required" : "인증 정보 필요함", + "Storage with ID \"%d\" not found" : "ID \"%d\"인 공유를 찾을 수 없음", "Invalid backend or authentication mechanism class" : "백엔드나 인증 방식 클래스가 잘못됨", "Invalid mount point" : "잘못된 마운트 지점", "Objectstore forbidden" : "Objectstore에 접근 금지됨", @@ -46,6 +50,7 @@ OC.L10N.register( "Unsatisfied authentication mechanism parameters" : "인증 방식 인자가 부족함", "Insufficient data: %s" : "충분하지 않은 데이터: %s", "%s" : "%s", + "Storage with ID \"%d\" is not user editable" : "저장소 ID \"%d\"을(를) 사용자가 편집할 수 없음", "Access key" : "접근 키", "Secret key" : "비밀 키", "Builtin" : "내장", @@ -98,6 +103,9 @@ OC.L10N.register( "OpenStack Object Storage" : "OpenStack 객체 저장소", "Service name" : "서비스 이름", "Request timeout (seconds)" : "요청 시간 제한(초)", + "The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "PHP의 cURL 지원이 비활성화되어 있거나 설치되어 있지 않습니다. %s을(를) 마운트할 수 없습니다. 시스템 관리자에게 설치를 요청하십시오.", + "The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "PHP의 FTP 지원이 비활성화되어 있거나 설치되어 있지 않습니다. %s을(를) 마운트할 수 없습니다. 시스템 관리자에게 설치를 요청하십시오.", + "\"%s\" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "\"%s\"이(가) 설치되어 있지 않습니다. %s을(를) 마운트할 수 없습니다. 시스템 관리자에게 설치를 요청하십시오.", "No external storage configured" : "외부 저장소가 설정되지 않았음", "You can add external storages in the personal settings" : "개인 설정에서 외부 저장소를 추가할 수 있습니다", "Name" : "이름", diff --git a/apps/files_external/l10n/ko.json b/apps/files_external/l10n/ko.json index 6b09b8076f6..c2922cf02b1 100644 --- a/apps/files_external/l10n/ko.json +++ b/apps/files_external/l10n/ko.json @@ -7,7 +7,7 @@ "External storages" : "외부 저장소", "External storage" : "외부 저장소", "Dropbox App Configuration" : "Dropbox 앱 설정", - "Google Drive App Configuration" : "구글 드라이브 앱 설정", + "Google Drive App Configuration" : "Google 드라이브 앱 설정", "Personal" : "개인", "System" : "시스템", "Grant access" : "접근 권한 부여", @@ -15,13 +15,16 @@ "Error configuring OAuth2" : "OAuth2 설정 오류", "Generate keys" : "키 생성", "Error generating key pair" : "키 쌍을 생성하는 중 오류 발생", - "All users. Type to select user or group." : "모든 사용자입니다. 사용자나 그룹을 선택하려면 입력하십시오", + "All users. Type to select user or group." : "모든 사용자입니다. 사용자나 그룹을 선택하려면 입력하십시오.", "(group)" : "(그룹)", + "Compatibility with Mac NFD encoding (slow)" : "Mac NFD 인코딩 호환성 사용(느림)", "Admin defined" : "관리자 지정", "Saved" : "저장됨", + "Saving..." : "저장 중...", "Save" : "저장", "Empty response from the server" : "서버에서 빈 응답이 돌아옴", "Couldn't access. Please logout and login to activate this mount point" : "접근할 수 없습니다. 이 마운트 지점을 활성화하려면 로그아웃 후 로그인하십시오", + "Couldn't get the information from the remote server: {code} {type}" : "원격 서버에서 정보를 가져올 수 없음: {code} {type}", "Couldn't get the list of external mount points: {type}" : "외부 마운트 지점 목록을 가져올 수 없음: {type}", "There was an error with message: " : "오류 메시지: ", "External mount error" : "외부 마운트 오류", @@ -34,6 +37,7 @@ "Credentials saved" : "인증 정보 저장됨", "Credentials saving failed" : "인증 정보를 저장할 수 없음", "Credentials required" : "인증 정보 필요함", + "Storage with ID \"%d\" not found" : "ID \"%d\"인 공유를 찾을 수 없음", "Invalid backend or authentication mechanism class" : "백엔드나 인증 방식 클래스가 잘못됨", "Invalid mount point" : "잘못된 마운트 지점", "Objectstore forbidden" : "Objectstore에 접근 금지됨", @@ -44,6 +48,7 @@ "Unsatisfied authentication mechanism parameters" : "인증 방식 인자가 부족함", "Insufficient data: %s" : "충분하지 않은 데이터: %s", "%s" : "%s", + "Storage with ID \"%d\" is not user editable" : "저장소 ID \"%d\"을(를) 사용자가 편집할 수 없음", "Access key" : "접근 키", "Secret key" : "비밀 키", "Builtin" : "내장", @@ -96,6 +101,9 @@ "OpenStack Object Storage" : "OpenStack 객체 저장소", "Service name" : "서비스 이름", "Request timeout (seconds)" : "요청 시간 제한(초)", + "The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "PHP의 cURL 지원이 비활성화되어 있거나 설치되어 있지 않습니다. %s을(를) 마운트할 수 없습니다. 시스템 관리자에게 설치를 요청하십시오.", + "The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "PHP의 FTP 지원이 비활성화되어 있거나 설치되어 있지 않습니다. %s을(를) 마운트할 수 없습니다. 시스템 관리자에게 설치를 요청하십시오.", + "\"%s\" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "\"%s\"이(가) 설치되어 있지 않습니다. %s을(를) 마운트할 수 없습니다. 시스템 관리자에게 설치를 요청하십시오.", "No external storage configured" : "외부 저장소가 설정되지 않았음", "You can add external storages in the personal settings" : "개인 설정에서 외부 저장소를 추가할 수 있습니다", "Name" : "이름", diff --git a/apps/files_external/l10n/pt_BR.js b/apps/files_external/l10n/pt_BR.js index 3f3cc25b6c2..34e488e865d 100644 --- a/apps/files_external/l10n/pt_BR.js +++ b/apps/files_external/l10n/pt_BR.js @@ -40,13 +40,13 @@ OC.L10N.register( "Credentials saving failed" : "A gravação das credenciais falhou", "Credentials required" : "Credenciais são requeridas", "Storage with ID \"%d\" not found" : "A armazenagem com a ID \"%d\" não foi encontrada", - "Invalid backend or authentication mechanism class" : "Backend ou classe de mecanismo de autenticação inválido", + "Invalid backend or authentication mechanism class" : "Plataforma de serviço ou classe de mecanismo de autenticação inválido", "Invalid mount point" : "Ponto de montagem inválido", "Objectstore forbidden" : "Proibido armazenamento de objetos", - "Invalid storage backend \"%s\"" : "Backend de armazenamento \"%s\" inválido", - "Not permitted to use backend \"%s\"" : "Não é permitido o uso de backend \"%s\"", + "Invalid storage backend \"%s\"" : "Plataforma de serviço de armazenamento \"%s\" inválido", + "Not permitted to use backend \"%s\"" : "Não é permitido o uso da plataforma de serviço \"%s\"", "Not permitted to use authentication mechanism \"%s\"" : "Não é permitido usar o mecanismo de autenticação \"%s\"", - "Unsatisfied backend parameters" : "Parâmetros de backend não atendidos", + "Unsatisfied backend parameters" : "Parâmetros da plataforma de serviço não atendidos", "Unsatisfied authentication mechanism parameters" : "Parâmetros de mecanismos de autenticação não satisfeitos", "Insufficient data: %s" : "Dados insuficientes: %s", "%s" : "%s", @@ -103,9 +103,9 @@ OC.L10N.register( "OpenStack Object Storage" : "Armazenamento de Objetos OpenStack", "Service name" : "Nome do serviço", "Request timeout (seconds)" : "Tempo requerido esgotado (segundos)", - "The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "O suporte a cURL no PHP não está habilitado ou instalado. A montagem de %s não é possível. Por favor, solicite a instalação ao administrador do sistema.", - "The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "O suporte a FTP no PHP não está habilitado ou instalado. A montagem de %s não é possível. Por favor, solicite a instalação ao administrador do sistema.", - "\"%s\" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "\"%s\" não está instalado. A montagem de %s não é possível. Por favor, solicite a instalação ao administrador do sistema.", + "The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "O suporte a cURL no PHP não está habilitado ou instalado. A montagem de %s não foi possível. Por favor, solicite a instalação ao administrador do sistema.", + "The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "O suporte a FTP no PHP não está habilitado ou instalado. A montagem de %s não foi possível. Por favor, solicite a instalação ao administrador do sistema.", + "\"%s\" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "\"%s\" não está instalado. A montagem de %s não foi possível. Por favor, solicite a instalação ao administrador do sistema.", "No external storage configured" : "Nenhum armazendo externo foi configurado", "You can add external storages in the personal settings" : "Você pode adicionar armazenamentos externos nas configurações pessoais", "Name" : "Nome", diff --git a/apps/files_external/l10n/pt_BR.json b/apps/files_external/l10n/pt_BR.json index 0475feb5d7b..7b8b9f7f14c 100644 --- a/apps/files_external/l10n/pt_BR.json +++ b/apps/files_external/l10n/pt_BR.json @@ -38,13 +38,13 @@ "Credentials saving failed" : "A gravação das credenciais falhou", "Credentials required" : "Credenciais são requeridas", "Storage with ID \"%d\" not found" : "A armazenagem com a ID \"%d\" não foi encontrada", - "Invalid backend or authentication mechanism class" : "Backend ou classe de mecanismo de autenticação inválido", + "Invalid backend or authentication mechanism class" : "Plataforma de serviço ou classe de mecanismo de autenticação inválido", "Invalid mount point" : "Ponto de montagem inválido", "Objectstore forbidden" : "Proibido armazenamento de objetos", - "Invalid storage backend \"%s\"" : "Backend de armazenamento \"%s\" inválido", - "Not permitted to use backend \"%s\"" : "Não é permitido o uso de backend \"%s\"", + "Invalid storage backend \"%s\"" : "Plataforma de serviço de armazenamento \"%s\" inválido", + "Not permitted to use backend \"%s\"" : "Não é permitido o uso da plataforma de serviço \"%s\"", "Not permitted to use authentication mechanism \"%s\"" : "Não é permitido usar o mecanismo de autenticação \"%s\"", - "Unsatisfied backend parameters" : "Parâmetros de backend não atendidos", + "Unsatisfied backend parameters" : "Parâmetros da plataforma de serviço não atendidos", "Unsatisfied authentication mechanism parameters" : "Parâmetros de mecanismos de autenticação não satisfeitos", "Insufficient data: %s" : "Dados insuficientes: %s", "%s" : "%s", @@ -101,9 +101,9 @@ "OpenStack Object Storage" : "Armazenamento de Objetos OpenStack", "Service name" : "Nome do serviço", "Request timeout (seconds)" : "Tempo requerido esgotado (segundos)", - "The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "O suporte a cURL no PHP não está habilitado ou instalado. A montagem de %s não é possível. Por favor, solicite a instalação ao administrador do sistema.", - "The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "O suporte a FTP no PHP não está habilitado ou instalado. A montagem de %s não é possível. Por favor, solicite a instalação ao administrador do sistema.", - "\"%s\" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "\"%s\" não está instalado. A montagem de %s não é possível. Por favor, solicite a instalação ao administrador do sistema.", + "The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "O suporte a cURL no PHP não está habilitado ou instalado. A montagem de %s não foi possível. Por favor, solicite a instalação ao administrador do sistema.", + "The FTP support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "O suporte a FTP no PHP não está habilitado ou instalado. A montagem de %s não foi possível. Por favor, solicite a instalação ao administrador do sistema.", + "\"%s\" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it." : "\"%s\" não está instalado. A montagem de %s não foi possível. Por favor, solicite a instalação ao administrador do sistema.", "No external storage configured" : "Nenhum armazendo externo foi configurado", "You can add external storages in the personal settings" : "Você pode adicionar armazenamentos externos nas configurações pessoais", "Name" : "Nome", diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index cc4cd641ce5..7afdb746a98 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -31,6 +31,7 @@ namespace OCA\Files_External\Lib\Storage; +use Icewind\SMB\Exception\AlreadyExistsException; use Icewind\SMB\Exception\ConnectException; use Icewind\SMB\Exception\Exception; use Icewind\SMB\Exception\ForbiddenException; @@ -90,6 +91,7 @@ class SMB extends Common implements INotifyStorage { throw new \Exception('Invalid configuration'); } $this->statCache = new CappedMemoryCache(); + parent::__construct($params); } /** @@ -162,10 +164,42 @@ class SMB extends Common implements INotifyStorage { * @return array */ protected function formatInfo($info) { - return array( + $result = [ 'size' => $info->getSize(), - 'mtime' => $info->getMTime() - ); + 'mtime' => $info->getMTime(), + ]; + if ($info->isDirectory()) { + $result['type'] = 'dir'; + } else { + $result['type'] = 'file'; + } + return $result; + } + + /** + * Rename the files. If the source or the target is the root, the rename won't happen. + * + * @param string $source the old name of the path + * @param string $target the new name of the path + * @return bool true if the rename is successful, false otherwise + */ + public function rename($source, $target) { + if ($this->isRootDir($source) || $this->isRootDir($target)) { + return false; + } + + $absoluteSource = $this->buildPath($source); + $absoluteTarget = $this->buildPath($target); + try { + $result = $this->share->rename($absoluteSource, $absoluteTarget); + } catch (AlreadyExistsException $e) { + $this->remove($target); + $result = $this->share->rename($absoluteSource, $absoluteTarget); + } catch (\Exception $e) { + return false; + } + unset($this->statCache[$absoluteSource], $this->statCache[$absoluteTarget]); + return $result; } /** @@ -220,6 +254,10 @@ class SMB extends Common implements INotifyStorage { * @return bool */ public function unlink($path) { + if ($this->isRootDir($path)) { + return false; + } + try { if ($this->is_dir($path)) { return $this->rmdir($path); @@ -239,26 +277,6 @@ class SMB extends Common implements INotifyStorage { } /** - * @param string $path1 the old name - * @param string $path2 the new name - * @return bool - */ - public function rename($path1, $path2) { - try { - $this->remove($path2); - $path1 = $this->buildPath($path1); - $path2 = $this->buildPath($path2); - return $this->share->rename($path1, $path2); - } catch (NotFoundException $e) { - return false; - } catch (ForbiddenException $e) { - return false; - } catch (ConnectException $e) { - throw new StorageNotAvailableException($e->getMessage(), $e->getCode(), $e); - } - } - - /** * check if a file or folder has been updated since $time * * @param string $path @@ -266,7 +284,7 @@ class SMB extends Common implements INotifyStorage { * @return bool */ public function hasUpdated($path, $time) { - if (!$path and $this->root == '/') { + if (!$path and $this->root === '/') { // mtime doesn't work for shares, but giving the nature of the backend, // doing a full update is still just fast enough return true; @@ -343,6 +361,10 @@ class SMB extends Common implements INotifyStorage { } public function rmdir($path) { + if ($this->isRootDir($path)) { + return false; + } + try { $this->statCache = array(); $content = $this->share->dir($this->buildPath($path)); diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index bbd79994e39..e463a0d3c37 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -88,7 +88,7 @@ ?> <form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>"> - <h2 data-anchor-name="external-storage"><?php p($l->t('External storage')); ?></h2> + <h2 data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2> <?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> <thead> diff --git a/apps/files_external/tests/Storage/SmbTest.php b/apps/files_external/tests/Storage/SmbTest.php index 45c01a0c59e..037c4cd4d39 100644 --- a/apps/files_external/tests/Storage/SmbTest.php +++ b/apps/files_external/tests/Storage/SmbTest.php @@ -132,4 +132,23 @@ class SmbTest extends \Test\Files\Storage\Storage { $this->assertEquals(new Change(IChange::ADDED, 'newfile.txt'), $result); } + + public function testRenameRoot() { + // root can't be renamed + $this->assertFalse($this->instance->rename('', 'foo1')); + + $this->instance->mkdir('foo2'); + $this->assertFalse($this->instance->rename('foo2', '')); + $this->instance->rmdir('foo2'); + } + + public function testUnlinkRoot() { + // root can't be deleted + $this->assertFalse($this->instance->unlink('')); + } + + public function testRmdirRoot() { + // root can't be deleted + $this->assertFalse($this->instance->rmdir('')); + } } |