@@ -58,13 +58,8 @@ public function fetchTargetThumbnail(File $file, string $target): ?string {
58
58
* @return resource|string
59
59
*/
60
60
public function convertFileTo (File $ file , string $ format ) {
61
- $ useTempFile = $ file ->isEncrypted () || !$ file ->getStorage ()->isLocal ();
62
- if ($ useTempFile ) {
63
- $ fileName = $ file ->getStorage ()->getLocalFile ($ file ->getInternalPath ());
64
- $ stream = fopen ($ fileName , 'r ' );
65
- } else {
66
- $ stream = $ file ->fopen ('r ' );
67
- }
61
+ $ fileName = $ file ->getStorage ()->getLocalFile ($ file ->getInternalPath ());
62
+ $ stream = fopen ($ fileName , 'rb ' );
68
63
69
64
if ($ stream === false ) {
70
65
throw new Exception ('Failed to open stream ' );
@@ -98,16 +93,11 @@ public function convertTo(string $filename, $stream, string $format) {
98
93
}
99
94
100
95
private function getRequestOptionsForFile (File $ file , ?string $ target = null ): array {
101
- $ useTempFile = $ file ->isEncrypted () || !$ file ->getStorage ()->isLocal ();
102
- if ($ useTempFile ) {
103
- $ localFile = $ file ->getStorage ()->getLocalFile ($ file ->getInternalPath ());
104
- if (!is_string ($ localFile )) {
105
- throw new NotFoundException ('Could not get local file ' );
106
- }
107
- $ stream = fopen ($ localFile , 'rb ' );
108
- } else {
109
- $ stream = $ file ->fopen ('rb ' );
96
+ $ localFile = $ file ->getStorage ()->getLocalFile ($ file ->getInternalPath ());
97
+ if (!is_string ($ localFile )) {
98
+ throw new NotFoundException ('Could not get local file ' );
110
99
}
100
+ $ stream = fopen ($ localFile , 'rb ' );
111
101
112
102
$ options = RemoteOptionsService::getDefaultOptions (25 );
113
103
$ options ['multipart ' ] = [
0 commit comments