Skip to content

Conversation

@sidasmo
Copy link
Member

@sidasmo sidasmo commented Mar 24, 2022

use SONARURL/files/ID?dl=1 for download stream with filenames

opts.headers.Range = `bytes=${opts.range.from || 0}-${opts.range.to || ''}`
}
return this.collection.fetch('/file/' + id, opts)
const query = opts.query || ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fetch function being used here (client/lib/fetch.js) already supports a params option with an object to set query string in the URL. So lets not add anothet way here. Instead add a doc comment that passing { params: { dl: 1 }} option will set the Content-Disposition header to attachement with the filename provided at upload, making the browser treat the file as a download (and not display in the browser).

@Frando
Copy link
Member

Frando commented Mar 25, 2022

Looks good! Added one comment, can be merged once that is addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants