Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@uppy/companion: remove randomness from file names #4509

Merged
merged 1 commit into from
Jun 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/@uppy/companion/src/server/helpers/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const dns = require('node:dns')
const ipaddr = require('ipaddr.js')
const got = require('got').default
const path = require('node:path')
const { randomUUID } = require('node:crypto')
const contentDisposition = require('content-disposition')

const logger = require('../logger')
Expand Down Expand Up @@ -139,7 +138,7 @@ exports.getURLMeta = async (url, blockLocalIPs = false) => {
// we add random string to avoid duplicate files
const filename = response.headers['content-disposition']
? contentDisposition.parse(response.headers['content-disposition']).parameters.filename
: `${path.basename(response.request.requestUrl)}-${randomUUID()}`
: path.basename(response.request.requestUrl)

// No need to get the rest of the response, as we only want header (not really relevant for HEAD, but why not)
stream.destroy()
Expand Down