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

Send version header #1564

Merged
merged 5 commits into from
May 17, 2019
Merged

Send version header #1564

merged 5 commits into from
May 17, 2019

Conversation

ifedapoolarewaju
Copy link
Contributor

@ifedapoolarewaju ifedapoolarewaju commented May 17, 2019

We’ve accidentally introduced breaking changes in @uppy/companion@1.0.1 in 156e86e#diff-7b39a69472a3e796126259ddff14f820R45.

This fix restores backwards-compatibility with Uppy Client ^1.0.0, by introducing uppyVersions param (in the future also an uppy-versions header). If this param is present, the authentication token is sent in a new way, as a string, otherwise it’s sent the old way, as JSON object (incompatible with IE).

You should use @uppy/companion@1.0.2 for backwards-compatibility, @uppy/companion@1.0.1 is deprecated.

Copy link
Contributor

@goto-bus-stop goto-bus-stop left a comment

Choose a reason for hiding this comment

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

thanks for fast turnaround! one comment + the stuff on slack

const allowedClients = req.uppy.options.clients
// if no preset clients then allow any client
if (!allowedClients || hasMatch(origin, allowedClients) || hasMatch(parseUrl(origin).host, allowedClients)) {
return res.send(htmlContent(uppyAuthToken, origin))
return res.send(clientVersion ? htmlContent(uppyAuthToken, origin) : oldHtmlContent(uppyAuthToken, origin))
Copy link
Contributor

Choose a reason for hiding this comment

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

This works but we should add a todo to the changelog to use https://www.npmjs.com/package/semver for these checks, especially if we're going to have more breaking changes.

Copy link
Contributor

@goto-bus-stop goto-bus-stop May 17, 2019

Choose a reason for hiding this comment

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

adding on asana so you can ignore the above

e; nvm you already did it, both is fine :P

@ifedapoolarewaju ifedapoolarewaju merged commit 824ce5f into master May 17, 2019
@kvz kvz deleted the send-version-header branch May 17, 2019 15:04
@arturi
Copy link
Contributor

arturi commented May 17, 2019

Yeah, +100 thanks for fast turnaround!

@@ -63,7 +63,7 @@ module.exports.app = (options = {}) => {
app.use((req, res, next) => {
res.header(
'Access-Control-Allow-Headers',
[res.get('Access-Control-Allow-Headers'), 'uppy-auth-token'].join(', ')
[res.get('Access-Control-Allow-Headers'), 'uppy-auth-token', 'uppy-client'].join(', ')
)
Copy link
Contributor

Choose a reason for hiding this comment

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

uppy-versions?

Copy link
Member

Choose a reason for hiding this comment

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

Uppy-Versions

Copy link
Member

Choose a reason for hiding this comment

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

Node.js will lowercase it for us, but i think so far we've tried to use uppercasing like that in tus/uppy headers

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.

4 participants