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

File size exceeds the maximum allowed 25000 bytes #69

Closed
orhun opened this issue Jul 27, 2022 · 12 comments · Fixed by #71 or #129
Closed

File size exceeds the maximum allowed 25000 bytes #69

orhun opened this issue Jul 27, 2022 · 12 comments · Fixed by #71 or #129

Comments

@orhun
Copy link

orhun commented Jul 27, 2022

Hello,

I have a README.md file of 39k and I can't upload it due to size limit. I'm using dockerhub-description action as follows:

      - name: Update Docker Hub description
        if: github.event_name != 'pull_request'
        uses: peter-evans/dockerhub-description@v3
        with:
          username: ${{ secrets.DOCKER_HUB_USERNAME }}
          password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

Related run: https://github.com/orhun/git-cliff/runs/7540171483

@orhun
Copy link
Author

orhun commented Jul 27, 2022

Related code:

const MAX_BYTES = 25000

Is the max byte limitation really necessary?

orhun added a commit to orhun/git-cliff that referenced this issue Jul 27, 2022
@peter-evans
Copy link
Owner

Hi @orhun

This limitation is imposed by DockerHub. The API will fail on larger sized payloads.

My advice would be to either reduce the size of your readme, or create a separate file which is the reduced-size version of your readme for upload to DockerHub. You can store this in your repo and reference it with the action.

@timbrown5
Copy link

This limitation is imposed by DockerHub. The API will fail on larger sized payloads.

I don't think this is true anymore. I can post to the API manually by doing;

export DH_TOKEN=$(curl https://hub.docker.com/v2/users/login -H 'Content-Type: application/json' -d "{\"username\": \"${DOCKERHUB_USERNAME}\", \"password\": \"${DOCKERHUB_PASSWORD}\"}" | jq -r '.token')
curl -XPATCH https://hub.docker.com/v2/repositories/my-org/my-repo -H 'Content-Type: application/json' -H "Authorization: Bearer ${DH_TOKEN}"  -d "{\"description\": \"$(cat ./description.md)\", \"full_description\": \"$(awk '{printf "%s\\n", $0}' ./readme.md)\" }"

@peter-evans
Copy link
Owner

peter-evans commented Aug 18, 2022

So I've tested the current behaviour of DockerHub's API and the 25000 byte limit still exists, however, instead of returning an error it now just truncates the readme content to 25000 bytes.

I think I will remove the 25000 limit and just allow DockerHub's API to truncate the content.

@peter-evans
Copy link
Owner

Released as v3.1.0 / v3.

The action no longer throws an error when the 25,000 byte content limit is exceeded. The request will be sent to DockerHub's API where DockerHub will truncate it to 25,000 bytes.

@leojonathanoh
Copy link

leojonathanoh commented Mar 4, 2023

Got the error happening today. The last time I successfully pushed > 25000 bytes which got automatically truncated to 25000 bytes without an error was early Feb 2023. So sometime between then and today Docker might have changed something. The CI error:

Run peter-evans/dockerhub-description@v3
Acquiring token
Sending PATCH request
Error: Bad Request

EDIT: If i manually updated the readme, it allows >25000 bytes, so the limit only happens when using the API.

@peter-evans
Copy link
Owner

@leojonathanoh Are you sure it is related to the size? Someone else had a similar issue recently and it might have been related to the content of the readme, not the size.

See #10 (comment)

@leojonathanoh
Copy link

just checked and there's no readme diff between Feb and today's, so perhaps something on their end might have changed the rules about what is a valid readme.

@leojonathanoh
Copy link

worked around it by splitting the readme up for now, but i'd still prefer everything to be in the readme. we'll have to see.

@peter-evans
Copy link
Owner

I just tested it and it seems that the API now returns 400 if the content is greater than 25000 bytes.

I'm going to implement a fix to truncate readme content to 25000 bytes.

@peter-evans peter-evans reopened this Mar 5, 2023
@leojonathanoh
Copy link

thank you! :)

@peter-evans
Copy link
Owner

Release v3.3.0 / v3. Readme content will now be truncated to 25000 bytes in a unicode-aware fashion. If content is truncated there will be a warning in the log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants