AceIDE / editor

Fork of the WPide ACE editor plugin for WordPress
GNU General Public License v3.0
22 stars 12 forks source link

Downloaded files have zero-width spaces at character 1 #15

Closed X-Raym closed 7 years ago

X-Raym commented 7 years ago

Hi !

When you download a file with right click-> Download from AceIDE, the downloaded file have a zero-width space character at position 1.

Zero-width spaces are pretty hard to see in a code editor, but I can clearly see it in Atom with Highlight Bad Characters plugin.

Demo

I can't really copy paste this character cause it is cleaned when I paste.

Could AceIDE be responsible of this ? I didn't find which files can be the culprit.

Thanks for your support !

shanept commented 7 years ago

Hi X-Raym,

I'd imagine that the ZWBS is being output somewhere else in the WordPress install. However, I've had a thought. Rather than fighting with other WP plugins, I am thinking of creating another AJAX endpoint, however with output buffering on and then loading in WP in the same way as the admin-ajax file. So it acts exactly the same, but output is buffered. In each ajax handler, we can then wipe the buffer clean before outputting, and this should remove almost all interference from other plugins/themes with Ace.

Having said that, I will check the plugin to ensure there are no invisibles being output before/after the file.

I thank YOU for the support you've given. Your assistance is greatly appreciated.

Kind Regards, Shane Thompson

X-Raym commented 7 years ago

@shanept You are right, it is probably something from my side (not the first time I have issue with ZWBS), I just tested from another server and I didn't have such issues. Feel free to close this issue then. :) But if this give you ideas to make the download function works better, then it's cool !

Thank you again for your support, and for maintaining this plugin !!

shanept commented 7 years ago

Thanks for looking into this for me. I might throw something together - would you be ok with uploading a zip of the master branch after I make modifications to see if it works for you?

X-Raym commented 7 years ago

@shanept you mean beta testing your new way to download file ? sure !

shanept commented 7 years ago

Awesome! You should see that I've just pushed a new commit which adds a new AJAX handler with output buffering. Far more stable than the current version's method to get rid of this type of noise. Now, if you've played around with composer before, feel free to just download a zip of this package, install the composer dependencies and upload it to your site. If not, I'm more than happy to provide you with a ZIP file with this already done. :)

X-Raym commented 7 years ago

@shanept I have to admit that I haven't played with composer so far, so if you are ok with a zip, I will really help :P Thanks !

shanept commented 7 years ago

Hi X-Raym,

This should do the job. Thanks again!

aceide.zip

X-Raym commented 7 years ago

@shanept tested, but there is a bug I think, cause I can't open a file by click on its name on the file list. It seems to load (there is the small icon) but the filer never open.

I have this in the log: Uncaught Error: Class 'AceIDEEditorModulesFileOps' not found in /home/extremraym/whatnot/wp-content/plugins/aceide/AceIDE.php:19

I rolled back to 2.5.5 and it works again.

Maybe something wrong with the current zip :P

shanept commented 7 years ago

That's bizarre, I uploaded it to my own install an had no issue... Let me zip it again and hope it was just a weird issue. aceide.zip

X-Raym commented 7 years ago

@shanept The new zip works ! I tested and I still had this ZWBS character. Don't worry, I found the culprit, it was on first character of my wp-config.php. I deleted it and now I don't have problem with AceIDE :)

Thanks again for your support ! I guess we can close the issue ? :)

shanept commented 7 years ago

I guess it was part of the other file and was saved into it at some point then. Being zero width, there could have been any amount of those characters there without your knowledge and it would require a hex editor to figure that out.

Either way, I'm glad for this issue as it has given us a better solution to get rid of this issue hopefully for good.

shanept commented 7 years ago

I didn't actually do anything different by the way, I just rezipped the same folder. Weird. Oh well, I think that solves this. Thanks for your help!

X-Raym commented 7 years ago

@shanept weird indeed, cause to be sure I tested with a copy of the previous zip, and it didn't work. It only works with the new one. Maybe it is something from my side, so don't worry.

Bye, and thanks again !