Webhook Image URLs Rewritten Incorrectly in Issues
Summary
This is working as documented on the webhooks page when introduced in !18109 (merged) . However, the rewritten URL seems to be incorrect.
Originally reported by a customer ZD (internal): https://gitlab.zendesk.com/agent/tickets/105370
Steps to reproduce
- Add an
Issue Events
webhook. - Create/edit an issue with an image.
- View the information sent in the log (or information received by the webhook).
- Go to the rewritten image URL.
Example Project
For example, when uploading a sample image, the relative URL in the issue is this: /uploads/b676a6e3462bef52621ad64e75f319fa/gitlab.png
When viewing the issue in the browser, this is the absolute image URL: https://gitlab.com/littlegreengeek/badattachmenturlsample/uploads/b676a6e3462bef52621ad64e75f319fa/gitlab.png
However, the image URL passed via the webhook is the following, and if you go to that URL, it throws a 404: https://gitlab.com/uploads/b676a6e3462bef52621ad64e75f319fa/gitlab.png
Pulled from sample project and issue: https://gitlab.com/littlegreengeek/badattachmenturlsample/issues/1
I have been able to reproduce this on another project on GitLab.com
What is the current bug behavior?
Image URL provided is incorrect and will throw a 404.
What is the expected correct behavior?
Should be the same image URL as when viewing the issue in the browser.
Relevant logs and/or screenshots
See image URL in the description:
"object_attributes": {
"action": "update",
"assignee_id": null,
"assignee_ids": [],
"author_id": 728095,
"closed_at": null,
"confidential": false,
"created_at": "2018-10-11 18:52:58 UTC",
"description": "Sample image ===== ![gitlab](https://gitlab.com/uploads/b676a6e3462bef52621ad64e75f319fa/gitlab.png) ===== Sample image \n\n* Go to http://littlegreen-gitlab-issue-images-url.requestcatcher.com/\n* Edit the issue\n* Check the request \n * You will see that:\n![image](https://gitlab.com/uploads/dbef590f65e2fcce1cfbd9168f812dd8/image.png)\n * Instead of that: \n![image](https://gitlab.com/uploads/35448e77f362688d902dcdf9982a408a/image.png)\n\n* To bad because:\n * https://gitlab.com/uploads/b676a6e3462bef52621ad64e75f319fa/gitlab.png is not the right url: \n * https://gitlab.com/littlegreengeek/badattachmenturlsample/uploads/b676a6e3462bef52621ad64e75f319fa/gitlab.png is the right one",
"due_date": null,
"human_time_estimate": null,
"human_total_time_spent": null,
"id": 14868842,
"iid": 1,
"last_edited_at": "2018-10-11 19:59:59 UTC",
"last_edited_by_id": 728095,
"milestone_id": null,
"moved_to_id": null,
"project_id": 8819710,
"relative_position": 1073742323,
"state": "opened",
"time_estimate": 0,
"title": "Edit this issue then check the image URL on the event hook",
"total_time_spent": 0,
"updated_at": "2018-10-12 20:41:49 UTC",
"updated_by_id": 2521041,
"url": "https://gitlab.com/littlegreengeek/badattachmenturlsample/issues/1",
"weight": null
},
Output of checks
This bug happens on GitLab.com , 11.4.0-rc3-ee