Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.

supporting multiple stripPrefix & replacePrefix entries via stripPrefixMulti #138

Merged

Conversation

SignpostMarv
Copy link
Contributor

The environment that I'm tinkering in with sw-precache at the moment maps requests to public/foo.txt to public-precached/foo.txt while public/bar.txt is where it says it is;

Example config:

{
  "stripPrefix": ["www-root/public-precached/", "www-root/public/"],
  "replacePrefix": "public/",
}

Thoughts/comments?

…ths to another directory (i.e. server sends foo/file.txt for requests to bar/file.txt, as well as caching bar/other-file.txt)
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@SignpostMarv
Copy link
Contributor Author

/me has signed the CLA, but wondering why it doesn't use oauth for account association (using an email other than my google email address here)

@googlebot
Copy link

CLAs look good, thanks!

@cdbattags
Copy link

Any ETA on this? See #141

@jeffposnick
Copy link
Contributor

As per #142 (comment), I think this can be closed without merging, correct?

@SignpostMarv
Copy link
Contributor Author

I've implemented the method described in my comment on 142

@jeffposnick
Copy link
Contributor

jeffposnick commented Jul 12, 2016

Unfortunately, one test for the existing stripPrefix option are failing due to the changes in this PR, which makes me concerned that it's not backwards compatible.

Could you please ensure that the implementation addresses backwards compatibility, as confirmed by the test? Additionally, it would be much appreciated if you could add a new test along the same lines for the new option.

if (
params.stripPrefix !== '' &&
params.replacePrefix !== '' &&
Object.keys(params.stripPrefixMulti).indexOf(params.stripPrefix) === -1
Copy link
Contributor

Choose a reason for hiding this comment

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

Using params.stripPrefix in params.stripPrefixMulti would be more concise.

@SignpostMarv SignpostMarv changed the title treat stripPrefix as an array to support environments that rewrite paths to another directory supporting multiple stripPrefix & replacePrefix entries via stripPrefixMulti Jul 12, 2016
@jeffposnick
Copy link
Contributor

jeffposnick commented Jul 12, 2016

Thanks, @SignpostMarv! 👍 from me, and this will be rolled into the upcoming 4.x release.

@jeffposnick jeffposnick merged commit e46423f into GoogleChromeLabs:master Jul 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants