Cache: 404 when key contains slash

Created on 4 Nov 2019  路  7Comments  路  Source: actions/cache

I think this has the same root cause as #43, except I am using my own custom string with slash (tmp release/benchmark) and receives 404 when trying to save the cache.

https://github.com/alexlamsl/UglifyJS2/runs/287169751
404

bug

Most helpful comment

The fix for the / issue has been deployed:
image

The fix for other special characters such as + and % is still in progress.

@alexlamsl @fsimonis while it's true that there isn't a replace expression function that would help here, you should be able to use ::set-output with sed or similar to do string replacement as a workaround.
e.g.

    - name: Sanitize key
      id: sanitize-key
      run: echo "::set-output name=key::$(echo $key | sed 's/+/plus/g')"  
    - uses: actions/cache@v1
      with:
        key: ${{ steps.sanitize-key.outputs.key }}
        path: .

Not the most ideal workaround, but unless I'm misunderstanding hopefully that'll work for you in the meantime!

All 7 comments

Seems like the cache key should be URL-encoded!

The cache key is already URL-encoded (see cacheHttpClient.ts) but I think there's some middleware on the server-side that's decoding it incorrectly, leading to the 404.

I'll leave this open since https://github.com/actions/cache/issues/43 has already been closed.

This issue extends to other symbols such as +.

I am compiling C++ code using the compilers g++ and clang++, which I put in the build matrix and in the cache key name. This results in 404.

Yes, % also doesn't work etc.

Wouldn't be so problematic if we can manipulate strings to replace certain characters, but since we can't it is kind of a showstopper issue 馃槗

Just an update, we're rolling out a fix on the server-side for this sometime today or early next week.

The fix for the / issue has been deployed:
image

The fix for other special characters such as + and % is still in progress.

@alexlamsl @fsimonis while it's true that there isn't a replace expression function that would help here, you should be able to use ::set-output with sed or similar to do string replacement as a workaround.
e.g.

    - name: Sanitize key
      id: sanitize-key
      run: echo "::set-output name=key::$(echo $key | sed 's/+/plus/g')"  
    - uses: actions/cache@v1
      with:
        key: ${{ steps.sanitize-key.outputs.key }}
        path: .

Not the most ideal workaround, but unless I'm misunderstanding hopefully that'll work for you in the meantime!

@zarenner thanks for the fix & the tip on string manipulations :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

evandrocoan picture evandrocoan  路  3Comments

FacetGraph picture FacetGraph  路  3Comments

KhaledSakr picture KhaledSakr  路  3Comments

Lyeeedar picture Lyeeedar  路  5Comments

wrightak picture wrightak  路  4Comments