From e1dbae14675a39d2678253eb628e55a674ce7b4d Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Thu, 18 Feb 2016 11:57:03 +0100
Subject: [PATCH] Properly trigger testRemote after getting a 404 from remote
 fed share

Whenever a remote fed share's shareinfo call returns a 404, don't
directly assume the storage is not available by throwing
StorageNotAvailableException. We need to properly throw
NotFoundException to trigger the later logic that calls testRemote()
that verifies that the 404 is not from a broken server but really from
an obsolete share.
---
 apps/files_sharing/lib/external/storage.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apps/files_sharing/lib/external/storage.php b/apps/files_sharing/lib/external/storage.php
index 783eea43c62..ba7fba654a9 100644
--- a/apps/files_sharing/lib/external/storage.php
+++ b/apps/files_sharing/lib/external/storage.php
@@ -252,6 +252,9 @@ class Storage extends DAV implements ISharedStorage {
 			if ($e->getCode() === 401 || $e->getCode() === 403) {
 				throw new ForbiddenException();
 			}
+			if ($e->getCode() === 404) {
+				throw new NotFoundException();
+			}
 			// throw this to be on the safe side: the share will still be visible
 			// in the UI in case the failure is intermittent, and the user will
 			// be able to decide whether to remove it if it's really gone
-- 
GitLab