Skip to content

Commit

Permalink
Merge pull request #164 from autonomys/remove-auth-check
Browse files Browse the repository at this point in the history
Fix some small issues with public links
  • Loading branch information
clostao authored Jan 30, 2025
2 parents e44e6f3 + a325056 commit be07556
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions backend/src/controllers/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,6 @@ objectController.get(
try {
const { id } = req.params

const user = await handleAuth(req, res)
if (!user) {
return
}

const { metadata, startDownload } =
await ObjectUseCases.downloadPublishedObject(id)
if (!metadata) {
Expand All @@ -351,11 +346,17 @@ objectController.get(
const safeName = encodeURIComponent(metadata.name || 'download')
if (metadata.type === 'file') {
res.set('Content-Type', metadata.mimeType || 'application/octet-stream')
res.set('Content-Disposition', `attachment; filename="${safeName}"`)
res.set('Content-Disposition', `filename="${safeName}"`)
res.set('Content-Length', metadata.totalSize.toString())
const compressedButNoEncrypted =
metadata.uploadOptions?.compression &&
!metadata.uploadOptions?.encryption
if (compressedButNoEncrypted) {
res.set('Content-Encoding', 'deflate')
}
} else {
res.set('Content-Type', 'application/zip')
res.set('Content-Disposition', `attachment; filename="${safeName}.zip"`)
res.set('Content-Disposition', `filename="${safeName}.zip"`)
}

pipeline(await startDownload(), res, (err) => {
Expand Down

0 comments on commit be07556

Please sign in to comment.