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

added: addContentDispositionFileName #1504

Merged
merged 5 commits into from
Apr 18, 2018

Conversation

ncaq
Copy link
Contributor

@ncaq ncaq commented Apr 17, 2018

Before submitting your PR, check that you've:

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

I pushed other pull request, I checkbox after complete other pull request.

This function is setting attchment file name.
Setting is hard that allow UTF-8 multibyte character.
This function running our product.
I want to push upstream.

@@ -780,6 +781,14 @@ deleteCookie a = addHeaderInternal . DeleteCookie (encodeUtf8 a) . encodeUtf8
setLanguage :: MonadHandler m => Text -> m ()
setLanguage = setSession langKey

-- | Set attachment file name.
--
-- allow UTF-8 character.
Copy link
Member

Choose a reason for hiding this comment

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

This should probably say something like: "Allows Unicode characters by encoding to UTF-8"

@@ -780,6 +781,14 @@ deleteCookie a = addHeaderInternal . DeleteCookie (encodeUtf8 a) . encodeUtf8
setLanguage :: MonadHandler m => Text -> m ()
setLanguage = setSession langKey

-- | Set attachment file name.
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a ChangeLog entry, cabal version bump, and a @since comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thinked that wait other pull request.
However, If I should write before it, I write.
So I write.

addContentDispositionFileName :: MonadHandler m => T.Text -> m ()
addContentDispositionFileName name
= addHeader "Content-Disposition" $
"attachment; filename*=UTF-8''" `mappend` decodeUtf8 (H.urlEncode True (encodeUtf8 name))
Copy link
Member

Choose a reason for hiding this comment

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

I haven't seen this syntax before. Can you reference the relevant spec that details how this is supposed to work in a comment?

@ncaq ncaq force-pushed the add-addContentDispositionFileName branch from d03ff94 to a59ee6b Compare April 17, 2018 09:48
@ncaq
Copy link
Contributor Author

ncaq commented Apr 17, 2018

@snoyberg I wrote comment, changelog.

@snoyberg snoyberg merged commit b92b2a0 into yesodweb:master Apr 18, 2018
@snoyberg
Copy link
Member

Thanks!

@ncaq ncaq deleted the add-addContentDispositionFileName branch April 18, 2018 06:22
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.

None yet

2 participants