Replies: 2
I have several plugins that will store attachments for posts in the upload folders in places other than 2019/10/xxxx
W3 CDN integration breaks the site on any of these files. The behavior is inconsistent as it will rewrite the paths to these files to load from CDN, but it does not translate the paths correctly so it consistently fails attempting to upload the files.
I have traced the problem to normalize_attachment_file in Cdn_Core. This method will take an attachment like this:
“awesome-support/ticket_123455.jpg”
and convert it to:
“ticket_123455.jpg”
Thus, stripping off the path to the file. It does not strip paths for folders match the YYYY/MM/ prefix. It will attempt to upload these files, which it cannot find because it looks in the wrong place.
Wordpress core is consistent with these types of attachments. If _wp_attached_file meta string starts with “/” or “?:” it treats it as an absolute path. If it is not an absolute path, it is to be appended to the UPLOAD_DIR with and added separator.
I cannot see any reason W3TC would attempt to strip off path information from attachments, which only seems to break things.
Can this be fixed?