jmdeldin / jmd_html

Textpattern plugin: Converts XHTML to HTML (OLD, UNSUPPORTED)
2 stars 1 forks source link

jmd_html v0.4 corrupts txp file downloads #1

Open philwareham opened 13 years ago

philwareham commented 13 years ago

The current version of jmd_html (v0.4) strips data out of files as they download when using Textpattern's in-built file tags, This causes the downloaded files to be corrupted.

More info: http://forum.textpattern.com/viewtopic.php?id=35609

AxelWinter commented 13 years ago

Hello Jon-Michael,

is there a chance that you have a look at the filed issue?

jmdeldin commented 13 years ago

Hi,

Thanks for reporting this. Sorry about the delay, but if you've seen my other plugins, you'll know I've been out of the TXP community for over a year. Regardless, here's a quick fix. Edit the plugin and replace these two lines at the top

if (txpinterface === 'public')
    ob_start('jmd_html');

with

if (txpinterface === 'public') {
  if (isset($_GET['s'] && $_GET['s'] === 'file_download')) {
    return false;
  }
  ob_start('jmd_html');
}

Let me know if it works for you.

(BTW, this plugin is largely obsolete with HTML5, since /> and > are both legal ending delimiters.)

AxelWinter commented 13 years ago

indeed it is, but the /> is only included for backwards compatibility, and I Like to stick as close to the standard as possible. Anyway thx

Axel

philwareham commented 13 years ago

Thanks, as with Axel, I use it for cleaner HTML5 on my site since /> is effectively obsolete now (even if it is valid)

AxelWinter commented 13 years ago

Same goes for me. JM posted a fix to it on Github, but I like my approach better, because it filters the TXP output when a page is "rendered". JM's fix parses everything except the file_download.

What do you think about the Idea to use it also on the admin side if needed?

Regarding the Form thing, My client does not want to have any extra costs, so I have to stick to opensource, or write things myself if needed. But anyway, THX for the offer

Sunny Greetz

[Axel]

-----Oprindelig meddelelse----- Fra: philwareham [mailto:reply+i-1002633-d9d8671e41e93ad5ebb639f2e038b21605057eb0@reply.githu b.com] Sendt: Freitag, 10. Juni 2011 11:12 Til: axel@meprojekt.dk Emne: Re: [jmd_html] jmd_html v0.4 corrupts txp file downloads (#1)

Thanks, as with Axel, I use it for cleaner HTML5 on my site since /> is effectively obsolete now (even if it is valid)

Reply to this email directly or view it on GitHub: https://github.com/jmdeldin/jmd_html/issues/1#comment_1340668

jmdeldin commented 13 years ago

So, does the fix work for either of you?

Same goes for me. JM posted a fix to it on Github, but I like my approach better, because it filters the TXP output when a page is "rendered". JM's fix parses everything except the file_download.

Care to share your approach, or have you released a new plugin?

What do you think about the Idea to use it also on the admin side if needed?

If you'd like to, just change the txpinterface to check for admin or public. I don't remember if there are other possible values, so you might be able to the conditional (minus the file-check). There's a small chance you'll break some older plugins that relied on the existence of /> for inserting content too (pre-pluggable_ui).

Regarding the Form thing, My client does not want to have any extra costs, so I have to stick to opensource, or write things myself if needed. But anyway, THX for the offer

Is this part of a separate conversation? I have no idea what you are talking about.

AxelWinter commented 13 years ago

sorry Jon,

I wrote a patch for the plugin before you posted yours here, and gave it to Phil. When the update on this issue dropped into my inbox I thought it was a reply from Phil.