WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#7568 closed defect (bug) (fixed)

automatic filetype detection for FTP Filesystem abstraction

Reported by: DD32 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)

7568.diff (1.5 KB) - added by DD32 13 years ago.
7568.2.diff (5.0 KB) - added by DD32 13 years ago.

Download all attachments as: .zip

Change History (7)

@DD32
13 years ago

#2 @DD32
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 @DD32
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

@DD32
13 years ago

#4 @DD32
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.

#5 @westi
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [8990]) Autodetect binary files for FTP filesystems. Fixes #7568 props DD32.

Note: See TracTickets for help on using tickets.