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

Fix slash handling on Windows #141

Merged
merged 1 commit into from
Sep 29, 2020
Merged

Conversation

newhoggy
Copy link
Collaborator

@newhoggy newhoggy commented Sep 29, 2020

Improper slashes is causing cabal-cache not upload and download Windows cache files properly.

For example, the following is wrong because it contains a backslash:

$ aws s3 ls s3://cache.haskellworks.io/archive/v2/ | tail
2020-09-29 17:01:23     383766 ghc-8.8.4\vector-algori_-0.8.0.3-88af0d3600ea52f012fdca75a650cee2463b0e6e.tar.gz
2020-09-29 17:01:23       3994 ghc-8.8.4\void-0.7.3-59d89ef78a6e609664eefc30f821d73828b396ad.tar.gz
2020-09-29 12:16:53      92547 ghc-8.8.4\wl-pprint-ann_-0.1.0.1-a665351d7e6d08267c97f0d09f378a4f4fd97253.tar.gz
2020-09-29 17:01:23     372818 ghc-8.8.4\x509-1.7.5-c41a65ece4e16647d99808ce56c8bf7f436ec385.tar.gz
2020-09-29 17:01:23      34184 ghc-8.8.4\x509-store-1.6.7-0fda4adee16700e1435f7734276e21b39e0e8cf6.tar.gz
2020-09-29 17:01:23      18567 ghc-8.8.4\x509-system-1.6.6-ebc0f0d98a03cc0902fe301650fdec2572476b6b.tar.gz
2020-09-29 17:01:23      75766 ghc-8.8.4\x509-validati_-1.6.11-7f096d9e1fbeb1daec735b3dd1e3a3f7c9879f74.tar.gz
2020-09-29 17:01:23     473155 ghc-8.8.4\xml-conduit-1.8.0.1-a72ab913e68d6a0fd976f0880e3bac5ca0e69db8.tar.gz
2020-09-29 17:01:23     167161 ghc-8.8.4\xml-types-0.3.8-dc8baa7126f32fad6d688450dc407f2f2a09dedd.tar.gz
2020-09-29 17:01:23     232282 ghc-8.8.4\zlib-0.6.2.2-ae9604d921906e2ac22203d9280aabe4ab07acd1.tar.gz

handleAwsError $ void $ runResAws envAws $ AWS.send po

reslashS3Uri :: S3Uri -> S3Uri
reslashS3Uri uri = uri & the @"objectKey" . the @1 %~ (T.replace "\\" "/")
Copy link
Contributor

Choose a reason for hiding this comment

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

can use reslashHttpUri here instead of T.replace

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I prefer not because an object key is not an http uri

@newhoggy newhoggy merged commit b365573 into master Sep 29, 2020
@newhoggy newhoggy deleted the fix-slash-handling-on-windows branch September 29, 2020 11:45
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.

2 participants