gildas-lormeau / SingleFile

Web Extension for saving a faithful copy of a complete web page in a single HTML file
GNU Affero General Public License v3.0
15.82k stars 1.02k forks source link

Saved SingleFile not viewing as complete HTML page when added to website #1612

Closed ChuckBergman closed 2 weeks ago

ChuckBergman commented 4 weeks ago

We are using SingleFile to save html files of our email newsletter. It seems to save the file correctly and when we view the file in a browser (Chrome, Edge, and Firefox) everything views correctly.

We are uploading the html file to our WordPress site and creating a URL link so our customers can view past email newsletters.

This process was working fine last week. But today the uploaded html file is basic-formatted text only. Background, formatting and graphics are no longer present.

gildas-lormeau commented 3 weeks ago

I don't think this problem is related to SingleFile. Perhaps there's been an update to your WordPress site?

ChuckBergman commented 3 weeks ago

I don't think this problem is related to SingleFile. Perhaps there's been an update to your WordPress site?

That is entirely possible. Maybe there is a conflict with a plug-in? Are there any known conflicts with wordpress or plug-ins?

gildas-lormeau commented 3 weeks ago

I'd have a hard time telling you, I'd need more details about the version of WordPress and the plugins you're using. Have you tried resetting the options in SingleFile (via the options page) and doing a test? Perhaps this is due to an option that has changed, for some reason.

ChuckBergman commented 3 weeks ago

I'd have a hard time telling you, I'd need more details about the version of WordPress and the plugins you're using. Have you tried resetting the options in SingleFile (via the options page) and doing a test? Perhaps this is due to an option that has changed, for some reason.

I was using the default settings in SingleFile. I tried editing some of the settings with no luck. Even tried SingleFile on 3 different browsers but getting the same result. You are correct that it is probably something to do with WordPress but I'm at a loss. I'm not a WordPress expert, just using the site that we are having designed for us. Somehow the formatting and graphics are being stripped out of the html files that we are uploading. When I view them in a browser from my workstation, they look great. It is only the uploaded files that are suddenly a problem.

2 weeks ago our uploads looked correct: https://aetechronstg.wpengine.com/wp-content/uploads/2024/10/SPiv249html.html

Now they look like this: https://aetechronstg.wpengine.com/wp-content/uploads/2024/11/SPiv2410html2.html

gildas-lormeau commented 3 weeks ago

The link to the incorrect page tends to confirm my theory. A large part of the stylesheets have been removed from the page. Image URLs have also been replaced with incorrect values. I'm not a WordPress expert either, unfortunately. If I were you, I'd try to see if there's an option in WordPress to disable the page “cleanup” of the newsletter. This option could be worded in such a way as to make it appear as if it helps make pages “safer” or more “compatible” with mail clients.

gildas-lormeau commented 3 weeks ago

Out of curiosity, how do you upload HTML files on your website?

ChuckBergman commented 3 weeks ago

If it is an HTML like these newsletters, we just upload thru the media library. Then link the URL with open in new tab setting.

Your mention of stylesheets is intriguing. We've had issues with Divi stylesheets overriding or conflicting with custom styles on certain pages. Maybe our Divi template styles are interfering with newsletters. Although it doesn't explain why it worked one week, then stopped working the next.

gildas-lormeau commented 2 weeks ago

Do you use this interface to upload the page? https://wordpress.com/support/uploading-documents/

I'm asking you this question because, officially, the HTML format is not supported, see https://wordpress.com/support/accepted-filetypes/. As a result, I'm a little intrigued...

ChuckBergman commented 2 weeks ago

Technically yes we are using a version of that interface. But we have a couple plug-ins installed.

We use Filebird Lite to organize our media library into folders. I don't think this impacts file type.

We added File Upload Types plug-in and that allows us to import file formats like html and eps.

gildas-lormeau commented 2 weeks ago

It looks like your issue is due to the feature "Sanitizing of SVG & HTML files" added in the last version (1.5.0) of the plug-in "File Upload Types", see the changelog here https://wordpress.org/plugins/file-upload-types/#developers.

ChuckBergman commented 2 weeks ago

Excellent catch! I wonder if there is a way to turn off that feature? Or I could disable the plug-in, upload the html newsletter, then turn back on. Not super efficient but I'll give it a try.

ChuckBergman commented 2 weeks ago

If I deactive the plugin, I can upload the html file with no problem! https://aetechronstg.wpengine.com/wp-content/uploads/2024/11/SPiv2410html.html

Even when I turn the plugin back on, file is still OK. It is only when it is active during upload that there is a problem.

Thank you for your troubleshooting on this issue!!!!!

gildas-lormeau commented 2 weeks ago

You're welcome! FYI, I'm not a PHP developer, but having a look at the code here https://plugins.trac.wordpress.org/browser/file-upload-types/trunk#src, in particular the Sanitizer files, I can't see anything that would disable this behavior.

I'm closing the issue since it's not a bug in SingleFile. Feel free to comment if needed though.