Skip to content

Commit

Permalink
fix: ensure zip uploads work on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
macite committed Jun 28, 2024
1 parent 1dc58ce commit 1857bdc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div class="flex flex-col gap-4">
<mat-checkbox matInput required [(ngModel)]="taskDefinition.assessmentEnabled" [disabled]="!overseerEnabled">
<mat-checkbox
matInput
required
[(ngModel)]="taskDefinition.assessmentEnabled"
[disabled]="!overseerEnabled"
>
Automation Enabled
</mat-checkbox>

Expand All @@ -13,7 +18,12 @@
<mat-hint>Docker image for Overseer</mat-hint>
</mat-form-field>

<f-file-drop mode="event" (filesDropped)="uploadOverseerResources($event)" accept="application/zip" [desiredFileName]="'Task ' + taskDefinition.abbreviation + ' Overseer zip'" />
<f-file-drop
mode="event"
(filesDropped)="uploadOverseerResources($event)"
accept="application/zip,application/x-zip-compressed"
[desiredFileName]="'Task ' + taskDefinition.abbreviation + ' Overseer zip'"
/>

<div class="flex flex-row gap-4">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ export class TaskDefinitionOverseerComponent implements OnChanges {
}

public uploadOverseerResources(files: FileList) {
const validFiles = Array.from(files as ArrayLike<File>).filter((f) => f.type === 'application/zip');
const validFiles = Array.from(files as ArrayLike<File>).filter(
(f) => f.type === 'application/zip' || f.type === 'application/x-zip-compressed',
);
if (validFiles.length > 0) {
const file = validFiles[0];
this.taskDefinitionService.uploadTaskResources(this.taskDefinition, file).subscribe({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class TaskDefinitionResourcesComponent {

public uploadTaskResources(files: FileList) {
const validFiles = Array.from(files as ArrayLike<File>).filter(
(f) => f.type === 'application/zip',
(f) => f.type === 'application/zip' || f.type === 'application/x-zip-compressed',
);
if (validFiles.length > 0) {
const file = validFiles[0];
Expand All @@ -83,7 +83,7 @@ export class TaskDefinitionResourcesComponent {
error: (message) => this.alerts.error(message, 6000),
});
} else {
this.alerts.error('Please drop a PDF to upload for this task', 6000);
this.alerts.error('Please drop a Zip to upload for this task', 6000);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,25 +139,4 @@ <h3>Task List</h3>
></f-task-definition-editor>
}
</div>
<!-- <div class="flex flex-col gap-4">
<h3>Batch Upload Tasks</h3>
<p>Batch upload task definitions with a CSV. Download to get format.</p>
<f-file-drop
mode="endpoint"
[endpoint]="unit.getTaskDefinitionBatchUploadUrl()"
desiredFileName="Task Definition csv"
accept="text/csv"
(uploadSuccess)="onSuccessTaskDefinitionBatchUpload($event)"
/>
<h3>Download Tasks</h3>
<p>Download all task definitions for this unit.</p>
<h3>Batch Upload Task PDFs</h3>
<p>Upload all of the task PDFs in a Zip file.</p>
<f-file-drop [endpoint]="unit.taskUploadUrl" accept="application/zip" desiredFileName="Task PDFs in zip" (uploadSuccess)="onSuccessTaskZipUpload($event)" />
</div> -->
</div>

0 comments on commit 1857bdc

Please sign in to comment.