Hi,
I have some yaml files loaded as dam assets and some of yaml files are directly uploaded under the /content/project/page/jcr:content/root/myComponent/file with the help of cq/gui/components/authoring/dialog/fileupload. When I try to get the content of the files(for example /content/dam/project/file.yaml) I got the response with the header Content-Disposition: attachment; filename="file.yaml" and download window opens.
I tried to change some OSGI configs, tried to write servlet and got no success.
What can I do to get the content of the yaml files?
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @agyrki ,
I wonder if you can downlaod the file, usually when you hit http://localhost:4502/content/dam/project/file.yaml in your browser (replace the necessary paths ) the file gets downloaded and then you can read it as a text file on your computer, unless you need to programatically read the yaml file and extract the content to use it for another purpose ?
Regards,
Anupam Patra
Views
Replies
Total Likes
Hello @anupampat,
there will be calls to this yaml files from 3rd party service and it will need to get the content of these files
Views
Replies
Total Likes
Hi @agyrki ,
If you want to have the functionality on dispatcher you can set content disposition inline.
Else you can create a filter for /content/dam pattern and check if extension of resource path contains .yaml set header to inline accordingly.
In the below post you may replace pdf with yaml and it should works
Thanks
@MukeshYadav_ thanks, I will try
Views
Replies
Total Likes
By the way I solved my problem with the help of the org.apache.sling.commons.mime.internal.MimeTypeServiceImpl.cfg.json.
I added to default values of the config my mimetype:
{
"mime.types": ""text/x-yaml yaml yml"
}
and the response header "Content-Type" changed from "application/octet-stream" to the "text/x-yaml" and now request to the /content/dam/project/file.yaml is showing file content.