소스 검색

Update MediaStorageService, improve head checks to fix failed jobs

Daniel Supernault 4 년 전
부모
커밋
1769cdfd74
1개의 변경된 파일11개의 추가작업 그리고 0개의 파일을 삭제
  1. 11 0
      app/Services/MediaStorageService.php

+ 11 - 0
app/Services/MediaStorageService.php

@@ -40,7 +40,18 @@ class MediaStorageService {
 		} catch (RequestException $e) {
 			return false;
 		}
+
 		$h = $r->getHeaders();
+
+		if (isset($h['Content-Length'], $h['Content-Type']) == false || 
+			empty($h['Content-Length']) ||
+			empty($h['Content-Type']) || 
+			$h['Content-Length'] < 10 ||
+			$h['Content-Length'] > (config('pixelfed.max_photo_size') * 1000)
+		) {
+			return false;
+		}
+
 		return [
 			'length' => $h['Content-Length'][0],
 			'mime' => $h['Content-Type'][0]