XF 1.2 Attachments, Pagespeed module, PNG and WebP images.

I run the nxg_pagespeed module on my server to optimize images. It converts JPEG images to PNG and WebP then rewrites URLs on the fly to serve images from the optimized cache. Unfortunately this doesn't work for XF attachments because without a known file extension the URLs to images can't be rewritten.

Is it possible to serve attachments with their file extensions in-tact so Pagespeed can capture and rewrite the URLs to point at the optimized cache?