Bitbucket export - process inline images
Asked by Remo Laubacher:

A customer of ours wanted to get all information stored in the issue tracker.

The export seemed to work very well at first. The json structure is great, easy to understand and complete. However, a bit later we noticed a problem.

When there's an inline image, we get something like this https://bitbucket.org/repo/ag22Epng/images/113876413-image.png (I changed the numbers a bit, it's just to illustrate it). When I open this in the browser, I'm being redirected to an amazon s3 storage. I understand that this happen due to security reasons.

Unfortunately, that also makes it a bit harder to process inline images and store them in a local folder. What is the best approach to download the whole issue tracker, not only issues meta data and attachments, but also inline pictures?


Answers:
author: Theodora Boudale
body: Hi Remo,

Unfortunately, there is no way to download these images with the export option in the issue tracker.

I have reached out to the development team to ask if it's possible to get them programmatically using the URLs in the json, as I'm facing some errors when I attempt to do this with one of my issue trackers for testing purposes.

I'll let you know as soon as I have an update.

Kind regards,  
Theodora

comments: author: Theodora Boudale
body: Hi Remo,

I spoke with one of the developers, and I'm afraid that inline images in the issue tracker can only be accessed via the browser at the moment and downloaded manually from the browser. We need a bit more time to figure out if it's a quick fix to make it possible to download them programmatically e.g. via curl or if it's going to be a more involved project.

Kind regards,  
Theodora


author: Remo Laubacher
body: Hi Theodora,

thanks for following up on this. While not very elegant, we can copy the cookie from the browser and use that in curl. I'm not sure about the expiration or any other security check in place, but we'll give it a try. At least one picture I managed to download by setting the copying the cookie.

Thanks,  
Remo


author: Theodora Boudale
body: Hi Remo,

Thank you for your reply.

After further testing, I'm afraid that there is no quick fix to allow app password authentication for these image URLs. The only workaround at the moment is by using the cookie, as you figured out yourself as well. The cookie should be treated as though it were an account password and kept as private as possible; I have asked about expiry and if there are any other concerns about using it, I'll keep you updated.

Kind regards,  
Theodora


author: Theodora Boudale
body: Hi Remo,

I discussed this a bit further with the development team. The use of a cookie for such requests is something we officially do not support and cannot assist with the details of such an implementation.

We do understand though that it is the only workaround to get the images programmatically instead of downloading them via browser (which can be time-consuming for a large number of issues and images). We would recommend assuming that a session can expire at any time for any reason. If you build a script to do something with a session cookie, you should make sure to track its progress and be able to pick up where it left off.

Kind regards,  
Theodora


author: Remo Laubacher
body: Thanks for your dedication to find a solution. We've been using a custom script that sets the cookie without any issues. I understand that you cannot guarantee that the cookie won't expire, but since we are only using this tool internally and not as part of a product, this is fine.

It may not be perfect, but it works.

Thanks!


author: Theodora Boudale
body: You are very welcome Remo! I'm glad to hear that it works.

I also wanted to let you know that we have a feature request to include these inline images in the issue tracker export zip: <https://jira.atlassian.com/browse/BCLOUD-17525>

The request has been closed as 'Won't fix' as there was not a lot of demand for it. However, I would encourage you to add your vote to it and leave a comment there, as our product managers continue to monitor even closed requests, and if there is more demand for it in the future they may reconsider.

Kind regards,  
Theodora


author: Remo Laubacher
body: Voting is disabled for resolved issues, but I left a comment.


author: Theodora Boudale
body: Apologies, I missed the fact that voting is disabled. A comment is good in this case.


Tags: bitbucket-cloud

cloud