Skip to content

Commit

Permalink
pkp#6057 Refactor submission files
Browse files Browse the repository at this point in the history
- Refactor how submission files are stored
  - New PKPFileService that uses Flysystem 1.x
  - Replace FileId/Revision with revision tracking in separate table
  - Remove file system data such as mimetype from database
  - Change to filenames stored on system
- Change downloaded filenames to use name property and
  anonymise filenames for anonymous reviews.
- Add SubmissionFile schema and service class
- Add API endpoints for submission files
- Replace file upload during submission with new Vue.js component
- Move locale property from Publication to Submission
- Change language for file genre settings
- Change submission file grids to use new SubmissionFileService
- Remove ArtworkFile and SupplementaryFile classes
- Add cli tool to get constant from its value

- pkp#5134 Clear assoc assignments when file is promoted
- pkp#6257 Update submission file policies
  • Loading branch information
NateWr committed Nov 12, 2020
1 parent d55739b commit 5f383f8
Show file tree
Hide file tree
Showing 237 changed files with 5,159 additions and 6,342 deletions.
12 changes: 6 additions & 6 deletions api/v1/_uploadPublicFile/PKPUploadPublicFileHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function uploadFile($slimRequest, $response, $args) {
$request = $this->getRequest();

if (empty($_FILES) || empty($_FILES['file'])) {
return $response->withStatus(400)->withJsonError('api.temporaryFiles.400.noUpload');
return $response->withStatus(400)->withJsonError('api.files.400.noUpload');
}

$siteDir = Core::getBaseDir() . '/' . Config::getVar('files', 'public_files_dir') . '/site';
Expand Down Expand Up @@ -163,18 +163,18 @@ public function uploadFile($slimRequest, $response, $args) {
switch ($fileManager->getUploadErrorCode($filename)) {
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
return $response->withStatus(400)->withJsonError('api.temporaryFiles.400.fileSize', ['maxSize' => Application::getReadableMaxFileSize()]);
return $response->withStatus(400)->withJsonError('api.files.400.fileSize', ['maxSize' => Application::getReadableMaxFileSize()]);
case UPLOAD_ERR_PARTIAL:
return $response->withStatus(400)->withJsonError('api.temporaryFiles.409.uploadFailed');
return $response->withStatus(400)->withJsonError('api.files.400.uploadFailed');
case UPLOAD_ERR_NO_FILE:
return $response->withStatus(400)->withJsonError('api.temporaryFiles.400.noUpload');
return $response->withStatus(400)->withJsonError('api.files.400.noUpload');
case UPLOAD_ERR_NO_TMP_DIR:
case UPLOAD_ERR_CANT_WRITE:
case UPLOAD_ERR_EXTENSION:
return $response->withStatus(400)->withJsonError('api.temporaryFiles.400.config');
return $response->withStatus(400)->withJsonError('api.files.400.config');
}
}
return $response->withStatus(400)->withJsonError('api.temporaryFiles.409.uploadFailed');
return $response->withStatus(400)->withJsonError('api.files.400.uploadFailed');
}

return $this->getResponse($response->withJson([
Expand Down
Loading

0 comments on commit 5f383f8

Please sign in to comment.