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

Avatars for Unicode usernames #1642

Merged
merged 1 commit into from
Dec 11, 2015
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions server/methods/setAvatarFromService.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Meteor.methods
throw new Meteor.Error('invalid-avatar-url', '[methods] setAvatarFromService -> url service -> invalid content-type')

ars = RocketChatFile.bufferToStream new Buffer(result.content, 'binary')
RocketChatFileAvatarInstance.deleteFile "#{user.username}.jpg"
aws = RocketChatFileAvatarInstance.createWriteStream "#{user.username}.jpg", result.headers['content-type']
RocketChatFileAvatarInstance.deleteFile encodeURIComponent("#{user.username}.jpg")
aws = RocketChatFileAvatarInstance.createWriteStream encodeURIComponent("#{user.username}.jpg"), result.headers['content-type']
aws.on 'end', Meteor.bindEnvironment ->
Meteor.setTimeout ->
console.log "Set #{user.username}'s avatar from the url: #{dataURI}"
Expand Down
2 changes: 1 addition & 1 deletion server/startup/avatar.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Meteor.startup ->
username: decodeURIComponent(req.url.replace(/^\//, '').replace(/\?.*$/, ''))

if params.username[0] isnt '@'
file = RocketChatFileAvatarInstance.getFileWithReadStream params.username
file = RocketChatFileAvatarInstance.getFileWithReadStream encodeURIComponent(params.username)
else
params.username = params.username.replace '@', ''

Expand Down