Skip to content
Snippets Groups Projects

Check for identity before identifier param in direct-upload

1 file
+ 14
5
Compare changes
  • Side-by-side
  • Inline
@@ -376,12 +376,21 @@ public class SubmissionController extends ControllerBase {
final @PathVariable String aid,
final @RequestParam(value = "file") MultipartFile file,
final @RequestParam String directUploadId,
final @Nullable @RequestParam(value = "identity", required = false) String reqIdentity,
final @Nullable @RequestParam(value = "identifier", required = false) String identifier
) throws IOException, URISyntaxException {
@Nullable
final String identity;
if (reqIdentity != null) {
identity = reqIdentity;
} else {
identity = identifier;
}
final var res = new Response();
//final var commit = this.getString(req, "commit", res);
logger.debug("Received trampoline message, assignment id {}, directUploadId {}, "
+ "identifier {}", aid, directUploadId, identifier);
logger.debug("Received direct upload, assignment id {}, directUploadId {}, "
+ "identity {}", aid, directUploadId, identity);
// Check if the original filename has an extension
final var originalFilename = file.getOriginalFilename();
@@ -420,12 +429,12 @@ public class SubmissionController extends ControllerBase {
assignment = assignmentRepository.save(assignment);
logger.debug("Created new submission for direct-upload submission, submission id {}", sid);
if (identifier == null) {
if (identity == null) {
logger.warn("Submission id {} does not belong to an identity", sid);
} else {
final var identityContainer = new IdentityContainer(sid, identifier);
final var identityContainer = new IdentityContainer(sid, identity);
this.repositories.getIdentityRepository().save(identityContainer);
logger.debug("Submission id {} belongs to {}", sid, identifier);
logger.debug("Submission id {} belongs to {}", sid, identity);
}
this.queue.add(new Job(assignment, submission));
Loading