Hi,
I tried to force pdf files as download instead of displaying them inline. So I changed the setting in my config:
settings.assetmanager.types.document.pdf = { serveAsAttachment=true, mimeType="application/pdf" };
Sound’s good, doesn’t work.
During debugging I found this (AssetDownload.cfc$asset (line 123ff)):
if ( type.trackDownloads ) {
if ( isFeatureEnabled( "websiteUsers" ) ) {
websiteUserActionService.recordAction(
action = "download"
, type = "asset"
, userId = getLoggedInUserId()
, identifier = assetId
);
}
header name="Content-Disposition" value="attachment; filename=""#filename#""";
} else {
header name="Content-Disposition" value="inline; filename=""#filename#""";
}
The serveAsAttachementsetting is completely ignored, instead the trackDownloads is validated.
This looks wrong to me. The case “yes, I want to force a download, but no, I don’t want to track it” doesn’t exist.
Is there a reason?
An
if( type.trackDownloads || type.serveAsAttachment ) {
if( isFeatureEnabled( "websiteUsers" ) && type.trackDownloads ) {
is the right one, I think.
I raised a ticket: PRESIDECMS-3166
Best
Michi