Skip to content

Commit

Permalink
refactor: make file URIs relative (#1215)
Browse files Browse the repository at this point in the history
* refactor: make file URIs relative

Closes: eclipse-pass/main#733

* remove concat host

- we don't need it because there is a leading slash on the file URI and default browser behavior is to use the same host if this is the case
  • Loading branch information
jaredgalanis authored Sep 26, 2023
1 parent 130b7e4 commit 75a58e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
21 changes: 10 additions & 11 deletions app/components/workflow-files/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
{{#if this.manuscript}}
<tr data-test-added-manuscript-row>
<td class="vertical-align-middle">
{{!-- {{#if manuscript.uri}} --}}
{{!-- <a href="{{manuscript.uri}}">
{{manuscript.name}}
{{#if this.manuscript.uri}}
<a href={{this.manuscript.uri}}>
{{this.manuscript.name}}
</a>
{{else}} --}}
{{this.manuscript.name}}
{{!-- {{/if}} --}}
{{else}}
{{this.manuscript.name}}
{{/if}}
</td>
<td class="text-center vertical-align-middle">
Manuscript
Expand All @@ -79,20 +79,19 @@
{{#each this.supplementalFiles as |file|}}
<tr data-test-added-supplemental-row>
<td class="vertical-align-middle">
{{!-- {{#if file.uri}}
{{#if file.uri}}
<a href="{{file.uri}}">
{{file.name}}
</a>
{{else}} --}}
{{file.name}}
{{!-- {{/if}} --}}
{{else}}
{{file.name}}
{{/if}}
</td>
<td class="text-center vertical-align-middle">
<select {{on "change" (fn this.updateFileRole file)}}>
<option value="supplement" selected={{eq file.fileRole "supplement"}}>
Supplement
</option>
{{!-- <option value="manuscript" selected={{eq file.fileRole "manuscript"}}>Manuscript</option> --}}
<option value="table" selected={{eq file.fileRole "table"}}>
Table
</option>
Expand Down
8 changes: 1 addition & 7 deletions app/components/workflow-files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default class WorkflowFiles extends Component {
mimeType: file.mimeType,
description: '',
fileRole: 'supplemental',
uri: `https://pass.local/file/${file.uuid}/${encodeURIComponent(file.fileName)}`,
uri: `/file/${file.uuid}/${encodeURIComponent(file.fileName)}`,
submission: this.args.submission,
});
if (!this.hasManuscript) {
Expand All @@ -129,12 +129,6 @@ export default class WorkflowFiles extends Component {
return;
}

// curl -X DELETE "http://localhost:8080/file/{fileId}/{origFileName}" -H "accept: application/json"
// TODO: once we resolve whether we should delete file binaries and file objects
// either remove or uncommment this
// await fetch(file.uri, { method: 'DELETE' });
// file.deleteRecord();

file.set('submission', undefined);
await file.save();
file.unloadRecord();
Expand Down

0 comments on commit 75a58e7

Please sign in to comment.