| @@ 86-88 (lines=3) @@ | ||
| 83 | /** @var File $file */ |
|
| 84 | $file = $this->userFolder->get($path); |
|
| 85 | ||
| 86 | if ($file instanceof Folder) { |
|
| 87 | return new DataResponse(['message' => $this->l->t('You can not open a folder')], Http::STATUS_BAD_REQUEST); |
|
| 88 | } |
|
| 89 | ||
| 90 | // default of 4MB |
|
| 91 | $maxSize = 4194304; |
|
| @@ 92-94 (lines=3) @@ | ||
| 89 | ||
| 90 | // default of 4MB |
|
| 91 | $maxSize = 4194304; |
|
| 92 | if ($file->getSize() > $maxSize) { |
|
| 93 | return new DataResponse(['message' => (string)$this->l->t('This file is too big to be opened. Please download the file instead.')], Http::STATUS_BAD_REQUEST); |
|
| 94 | } |
|
| 95 | $fileContents = $file->getContent(); |
|
| 96 | if ($fileContents !== false) { |
|
| 97 | $writable = $file->isUpdateable(); |
|
| @@ 153-155 (lines=3) @@ | ||
| 150 | /** @var File $file */ |
|
| 151 | $file = $this->userFolder->get($path); |
|
| 152 | ||
| 153 | if ($file instanceof Folder) { |
|
| 154 | return new DataResponse(['message' => $this->l->t('You can not write to a folder')], Http::STATUS_BAD_REQUEST); |
|
| 155 | } |
|
| 156 | ||
| 157 | // Get file mtime |
|
| 158 | $filemtime = $file->getMTime(); |
|
| @@ 102-104 (lines=3) @@ | ||
| 99 | $range = $this->request->getHeader('Range'); |
|
| 100 | if ($range !== '') { |
|
| 101 | $matches = []; |
|
| 102 | if (preg_match('/bytes=0-(\d+)$/', $range, $matches) === 0) { |
|
| 103 | return new DataResponse(['message' => $this->l->t('Invalid range request')], Http::STATUS_REQUEST_RANGE_NOT_SATISFIABLE); |
|
| 104 | } |
|
| 105 | $range = (int)$matches[1]; |
|
| 106 | } else { |
|
| 107 | $range = -1; |
|