Ticket #2166 (closed defect (bug): fixed)

Opened 6 years ago

Last modified 5 years ago

# in uploaded image filename breaks uploader

Reported by: Viper007Bond Owned by: skeltoac
Priority: normal Milestone:
Component: Administration Version: 1.2
Severity: normal Keywords: bg|has-patch bg|commit
Cc:

Description

Rename an image to have a # in it, ex:

2003 Dodge Viper SRT-10 #09.jpg

If you upload it, it uploads fine, but then when it goes to display the thumbnail or insert into the post, this is the URL it uses:

2003%20Dodge%20Viper%20SRT-10%20#09.thumbnail.jpg

Rather than:

2003%20Dodge%20Viper%20SRT-10%20%2309.thumbnail.jpg

That causes a 404 on the image.

No patch as I don't know Javascript.

Attachments

2166.diff Download (2.2 KB) - added by davidhouse 6 years ago.
lose-those-pounds.diff Download (454 bytes) - added by skeltoac 6 years ago.

Change History

comment:1   ryan6 years ago

  • Owner changed from anonymous to skeltoac
  • Keywords bg|has-patch added

There wasn't actually any javascript involved. :) This patch will need a quick run-through by the committor, because I don't use the image uploader and so I'm not entirely sure if the patch works completely or not.

  • Status changed from new to assigned

wp-admin/admin-functions.php line 1752 is the only place that needs rawurlencode. However, when I test in FF and IE, %23 is in the src and href but the browser decodes it and puts # in the request, which of course gets a 404.

I think it would be better to replace # with _

  • Keywords bg|commit added

Whatever Andy's happy with :)

comment:5   ryan6 years ago

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

(In [3394]) Strip # from filenames. fixes #2166

comment:6   ryan6 years ago

  • Milestone set to 2.0.1
  • Milestone 2.0.1 deleted

Milestone 2.0.1 deleted

Note: See TracTickets for help on using tickets.