aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/BulkUpload
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/BulkUpload')
-rw-r--r--apps/dav/lib/BulkUpload/BulkUploadPlugin.php14
-rw-r--r--apps/dav/lib/BulkUpload/MultipartRequestParser.php26
2 files changed, 20 insertions, 20 deletions
diff --git a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php
index ae7f55d7107..8a99beaec6a 100644
--- a/apps/dav/lib/BulkUpload/BulkUploadPlugin.php
+++ b/apps/dav/lib/BulkUpload/BulkUploadPlugin.php
@@ -44,7 +44,7 @@ class BulkUploadPlugin extends ServerPlugin {
*/
public function httpPost(RequestInterface $request, ResponseInterface $response): bool {
// Limit bulk upload to the /dav/bulk endpoint
- if ($request->getPath() !== "bulk") {
+ if ($request->getPath() !== 'bulk') {
return true;
}
@@ -77,16 +77,16 @@ class BulkUploadPlugin extends ServerPlugin {
$node = $this->userFolder->getFirstNodeById($node->getId());
$writtenFiles[$headers['x-file-path']] = [
- "error" => false,
- "etag" => $node->getETag(),
- "fileid" => DavUtil::getDavFileId($node->getId()),
- "permissions" => DavUtil::getDavPermissions($node),
+ 'error' => false,
+ 'etag' => $node->getETag(),
+ 'fileid' => DavUtil::getDavFileId($node->getId()),
+ 'permissions' => DavUtil::getDavPermissions($node),
];
} catch (\Exception $e) {
$this->logger->error($e->getMessage(), ['path' => $headers['x-file-path']]);
$writtenFiles[$headers['x-file-path']] = [
- "error" => true,
- "message" => $e->getMessage(),
+ 'error' => true,
+ 'message' => $e->getMessage(),
];
}
}
diff --git a/apps/dav/lib/BulkUpload/MultipartRequestParser.php b/apps/dav/lib/BulkUpload/MultipartRequestParser.php
index 2d3cf7d421c..b6c4fbcc1be 100644
--- a/apps/dav/lib/BulkUpload/MultipartRequestParser.php
+++ b/apps/dav/lib/BulkUpload/MultipartRequestParser.php
@@ -19,10 +19,10 @@ class MultipartRequestParser {
private $stream;
/** @var string */
- private $boundary = "";
+ private $boundary = '';
/** @var string */
- private $lastBoundary = "";
+ private $lastBoundary = '';
/**
* @throws BadRequest
@@ -39,7 +39,7 @@ class MultipartRequestParser {
}
if ($contentType === null) {
- throw new BadRequest("Content-Type can not be null");
+ throw new BadRequest('Content-Type can not be null');
}
$this->stream = $stream;
@@ -60,7 +60,7 @@ class MultipartRequestParser {
[$mimeType, $boundary] = explode(';', $contentType);
[$boundaryKey, $boundaryValue] = explode('=', $boundary);
} catch (\Exception $e) {
- throw new BadRequest("Error while parsing boundary in Content-Type header.", Http::STATUS_BAD_REQUEST, $e);
+ throw new BadRequest('Error while parsing boundary in Content-Type header.', Http::STATUS_BAD_REQUEST, $e);
}
$boundaryValue = trim($boundaryValue);
@@ -96,7 +96,7 @@ class MultipartRequestParser {
$seekBackResult = fseek($this->stream, -$expectedContentLength, SEEK_CUR);
if ($seekBackResult === -1) {
- throw new Exception("Unknown error while seeking content", Http::STATUS_INTERNAL_SERVER_ERROR);
+ throw new Exception('Unknown error while seeking content', Http::STATUS_INTERNAL_SERVER_ERROR);
}
return $expectedContent === $content;
@@ -134,7 +134,7 @@ class MultipartRequestParser {
$headers = $this->readPartHeaders();
- $content = $this->readPartContent($headers["content-length"], $headers["x-file-md5"]);
+ $content = $this->readPartContent($headers['content-length'], $headers['x-file-md5']);
return [$headers, $content];
}
@@ -146,7 +146,7 @@ class MultipartRequestParser {
*/
private function readBoundary(): string {
if (!$this->isAtBoundary()) {
- throw new BadRequest("Boundary not found where it should be.");
+ throw new BadRequest('Boundary not found where it should be.');
}
return fread($this->stream, strlen($this->boundary));
@@ -180,12 +180,12 @@ class MultipartRequestParser {
}
}
- if (!isset($headers["content-length"])) {
- throw new LengthRequired("The Content-Length header must not be null.");
+ if (!isset($headers['content-length'])) {
+ throw new LengthRequired('The Content-Length header must not be null.');
}
- if (!isset($headers["x-file-md5"])) {
- throw new BadRequest("The X-File-MD5 header must not be null.");
+ if (!isset($headers['x-file-md5'])) {
+ throw new BadRequest('The X-File-MD5 header must not be null.');
}
return $headers;
@@ -201,7 +201,7 @@ class MultipartRequestParser {
$computedMd5 = $this->computeMd5Hash($length);
if ($md5 !== $computedMd5) {
- throw new BadRequest("Computed md5 hash is incorrect.");
+ throw new BadRequest('Computed md5 hash is incorrect.');
}
if ($length === 0) {
@@ -215,7 +215,7 @@ class MultipartRequestParser {
}
if ($length !== 0 && feof($this->stream)) {
- throw new Exception("Unexpected EOF while reading stream.");
+ throw new Exception('Unexpected EOF while reading stream.');
}
// Read '\r\n'.