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

Using same image multiple times results in an upload error #433

Open
elvinasp opened this issue Mar 27, 2024 · 4 comments
Open

Using same image multiple times results in an upload error #433

elvinasp opened this issue Mar 27, 2024 · 4 comments
Labels

Comments

@elvinasp
Copy link

What happened?

Trying to create a a page with multiple repeated images results in an image upload error due to same attachment is being attempted to upload multiple times.

Initially I was trying to reuse already existing image attachments for the other page, that resulted in the same error. So I have tried to rename files for this particular page essentially duplicating images with different names between pages. However it seems not possible to even reuse image within same page.

What did you expect to happen?

Page generated with multiple links to the same image file.
Same image file is not uploaded multiple times, i.e. either upload list is made unique either image file existence is checked, either image is overwritten using JIRA image ID.

How can we reproduce the behavior you experienced?

Steps to reproduce the behavior:

  1. Add a image to a image folder.
  2. Create a markdown with multiple links to the same image path.
  3. Try to upload image.

In case this is related to specific markdown, please provide a minimal markdown example here.

...
3. Open a session by right-clicking on a Windows Server, usually a -JUMP or -BKP machine. Choose **Open Session**<br/>
![Open Session](./images/shutdown-opening-session.png)
Some other instructions.
3. Open a session by right-clicking on a Windows Server, usually a -JUMP or -BKP machine. Choose **Open Session**<br/>
![Open Session](./images/shutdown-opening-session.png)
...
      # Iterate over list of new/updated '.md' files and upload to confluence
      for file in $(git diff-tree --diff-filter=AM --no-commit-id --name-only -r HEAD | grep '\.md$'); do
        # Update README markdown file
        docker run --rm --name confluence-docs-update \
          -v ${bamboo.hostvolume}:/code \
          -v ${bamboo.hostvolume}/vi_certs:/usr/local/share/ca-certificates \
          -w /code \
          kovetskiy/mark:9.4.0 \
          /bin/bash -c "update-ca-certificates; mark -u ${bamboo.confluence_username} -p ${bamboo.confluence_password} -b ${bamboo.confluence_url} --title-from-h1 --trace --space CONPL -f $file || exit 1;"
      done

Further Information (please complete the following information)

  • Mark Version (mark --version): [e.g. v9.4.0]
  • Mark Parameters: [e.g. --title-from-h1 --trace --space CONPL -f $file]
  • Confluence Hosting: [Server]
  • Confluence Version: [e.g. v8.5.4]
  • Environment specific Information: [e.g. running in Bamboo as Docker container]

Logs or other output

error	27-Mar-2024 08:04:24	2024-03-27 07:04:22.806 TRACE rest: HTTP/1.1 400 
error	27-Mar-2024 08:04:24	                              Cache-Control: no-store
error	27-Mar-2024 08:04:24	                              Content-Type: application/json
error	27-Mar-2024 08:04:24	                              Date: Wed, 27 Mar 2024 07:04:21 GMT
error	27-Mar-2024 08:04:24	                              Expires: Thu, 01 Jan 1970 00:00:00 GMT
error	27-Mar-2024 08:04:24	                              Strict-Transport-Security: max-age=31536000
error	27-Mar-2024 08:04:24	                              Vary: User-Agent
error	27-Mar-2024 08:04:24	                              X-Ausername: srv.conpldocs
error	27-Mar-2024 08:04:24	                              X-Content-Type-Options: nosniff
error	27-Mar-2024 08:04:24	                              X-Seraph-Loginreason: OK
error	27-Mar-2024 08:04:24	                              
error	27-Mar-2024 08:04:24	                              {"statusCode":400,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"Cannot add a new attachment with same file name as an existing attachment: ._images_shutdown-opening-session.png","reason":"Bad Request"}
error	27-Mar-2024 08:04:24	2024-03-27 07:04:22.806 FATAL unable to create/update attachments
error	27-Mar-2024 08:04:24	                              ?????? unable to create attachment "./images/shutdown-opening-session.png"
error	27-Mar-2024 08:04:24	                                 ?????? Confluence API returned unexpected status: 400 , output: "{\"statusCode\":400,\"data\":{\"authorized\":false,\"valid\":true,\"allowedInReadOnlyMode\":true,\"errors\":[],\"successful\":false},\"message\":\"Cannot add a new attachment with same file name as an existing attachment: ._images_shutdown-opening-session.png\",\"reason\":\"Bad Request\"}"
simple	27-Mar-2024 08:04:24	Failing task since return code of [/home/bamboo/bamboo-agent-home/temp/CONPL-BOOTSTRAPOVA203-JOB3-6-ScriptBuildTask-3539286694307196874.sh] was 1 while expected 0
simple	27-Mar-2024 08:04:24	Finished task 'Script' with result: Failed
-- | --
27-Mar-2024 08:04:24 | 2024-03-27 07:04:22.806 FATAL unable to create/update attachments

Additional context

.

@elvinasp elvinasp added the bug label Mar 27, 2024
@AX-LLaidley
Copy link

I am also experiencing this issue.

@djpbessems
Copy link

Worth noting, that if you try to process the same page unaltered on a subsequent run, the page is rendered without further errors.

@AX-LLaidley
Copy link

@djpbessems I tried doing that multiple times, to no avail. I think this may also be related to the issue I submitted #432 I'm awaiting resolution on this, as all of the docs that we've synced to our Confluence draft space have had the images borked, which is making updates way harder than they need to be.

@koseduhemak
Copy link

same problem here.

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

No branches or pull requests

4 participants