diff options
Diffstat (limited to 'lib/Service/CacheDocumentService.php')
-rw-r--r-- | lib/Service/CacheDocumentService.php | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/Service/CacheDocumentService.php b/lib/Service/CacheDocumentService.php index 579d379b..22fb640d 100644 --- a/lib/Service/CacheDocumentService.php +++ b/lib/Service/CacheDocumentService.php @@ -31,6 +31,10 @@ namespace OCA\Social\Service; use daita\MySmallPhpTools\Exceptions\MalformedArrayException; +use daita\MySmallPhpTools\Exceptions\RequestContentException; +use daita\MySmallPhpTools\Exceptions\RequestNetworkException; +use daita\MySmallPhpTools\Exceptions\RequestResultSizeException; +use daita\MySmallPhpTools\Exceptions\RequestServerException; use daita\MySmallPhpTools\Model\Request; use daita\MySmallPhpTools\Traits\TArrayTools; use daita\MySmallPhpTools\Traits\TStringTools; @@ -40,11 +44,6 @@ use Gumlet\ImageResizeException; use OCA\Social\Exceptions\CacheContentException; use OCA\Social\Exceptions\CacheContentMimeTypeException; use OCA\Social\Exceptions\CacheDocumentDoesNotExistException; -use OCA\Social\Exceptions\RequestContentException; -use OCA\Social\Exceptions\RequestNetworkException; -use OCA\Social\Exceptions\RequestResultNotJsonException; -use OCA\Social\Exceptions\RequestResultSizeException; -use OCA\Social\Exceptions\RequestServerException; use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\UnauthorizedFediverseException; use OCA\Social\Model\ActivityPub\Object\Document; @@ -122,7 +121,6 @@ class CacheDocumentService { * @throws NotPermittedException * @throws RequestContentException * @throws RequestNetworkException - * @throws RequestResultNotJsonException * @throws RequestResultSizeException * @throws RequestServerException * @throws SocialAppConfigException @@ -238,6 +236,13 @@ class CacheDocumentService { throw new CacheDocumentDoesNotExistException(); } + // right now, we do not handle cache for local avatar, we need to change this + // so the current avatar is cached, or a new avatar is uploaded + if ($path === 'avatar') { + throw new CacheContentException(); + } + + $pos = strrpos($path, '/'); $dir = substr($path, 0, $pos); $filename = substr($path, $pos + 1); @@ -260,7 +265,6 @@ class CacheDocumentService { * @throws MalformedArrayException * @throws RequestContentException * @throws RequestNetworkException - * @throws RequestResultNotJsonException * @throws RequestResultSizeException * @throws RequestServerException * @throws SocialAppConfigException @@ -273,7 +277,7 @@ class CacheDocumentService { $request->setAddress($url['host']); $request->setProtocol($url['scheme']); - $content = $this->curlService->request($request); + $content = $this->curlService->doRequest($request); return $content; } |