Opened 13 years ago
Closed 13 years ago
#7568 closed defect (bug) (fixed)
automatic filetype detection for FTP Filesystem abstraction
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 2.7 | Priority: | normal |
| Severity: | normal | Version: | 2.6 |
| Component: | Administration | Keywords: | has-patch needs-testing |
| Focuses: | Cc: |
Description
As reported by Viper007Bond on IRC:
When upgrading a plugin which contains font files, the files get transfered via ASCII instead of BINARY mode, The result is unuseable fonts, which causes the plugin to break.
A example plugin of this is cForms.
The attached patch sets .ttf files to be transfered in binary mode
Future Note: It might be good for the filetypes not to be hardcoded, and the ftp process determine if its a Binary or text file before defaulting to one or the other.
Attachments (2)
Change History (7)
#2
@
13 years ago
Ahhh, sounds like you catch it DD32
I thought i had heard of something similar..
It might be worth adding Flash and other common formats to the array as well.
Something also seems to be telling me theres a function in WP somewhere which might be useable for this task too, Allthough i'm possibly thinking of the Uploaders mime-type functions..
#3
@
13 years ago
- Keywords needs-patch added; has-patch removed
Also affected: .swf files
something like this:
$binary = (bool)preg_match('<charcode | >charcode', $filedata)
should be useable to replace that array, wrapped in is_binary_string() or something similar?
Need to check how that'll handle utf8 strings
Changing to needs-patch as the patch is really a short-term solution, something better needs to be implented
#4
@
13 years ago
- Keywords has-patch needs-testing added; needs-patch removed
- Summary changed from certain binary files(.ttf) broken on plugin upgrade to automatic filetype detection for FTP Filesystem abstraction
Patch attached, I've tested a few plugins with .swf and a few other file types which were having issues, This appears to have fixed it.
A Ascii file is anything from this table: http://www.asciitable.com/ of Space through to ~, If it contains any other characters its a Binary file.
I havnt tested with files with UTF8 characters, I suspect they'd be claimed as a binary file.. however i'm not sure FTP could transfer those files as ASCII anyway.. Needs testing.
Ahhh, sounds like you catch it DD32
http://comox.textdrive.com/pipermail/wp-hackers/2008-April/019463.html