Forum Discussion
haratsu
Oct 13, 2023Copper Contributor
DevOps Wiki: How to enable download of attachment
Hello, I do have a git based wiki in ADO with the following structure: | ---- REAGME.md
| ---- .attachments
| ---- config.xml Within README.md I want to reference config.xml in a way t...
mohammedmubeen
Oct 13, 2023Copper Contributor
ADO markdown to make an attachment downloadable
[Config](./.attachments/config.xml?download=true)
To define the attachment
[Config](./.attachments/config.xml?download=true&fileName=my-config.xml)
- haratsuOct 13, 2023Copper Contributor
Thanks for your reply, but as mentioned in my initial post this is what i already tried. ADO is messing up the url when using your approach resulting in the folloing error:
{ "$id":"1", "innerException":null, "message":"TF401174: The item 'wiki/.attachments/config.xml?download=true&fileName=config.xml' could not be found in the repository '<nonOfYourBusiness>' at the version specified by '<Branch: feature/2191 >' (resolved to commit '1dfc...bfd4')", "typeName":"Microsoft.TeamFoundation.Git.Server.GitItemNotFoundException, Microsoft.TeamFoundation.Git.Server", "typeKey":"GitItemNotFoundException", "errorCode":0, "eventId":3000 }
The reason for that - as mentioned above - is that the resulting url contains no real url parameters but encodes any char "?" or "&" as utf escaped char:
https://.../_apis/git/repositories/.../Items?path=/wiki/.attachments/config.xml%3Fdownload%3Dtrue%26fileName%3Dconfig.xml&download=false&resolveLfs=true&%24format=octetStream&api-version=5.0-preview.1&sanitize=true&versionDescriptor.version=feature/2191