WordPress.org

Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10224 closed enhancement (fixed)

wptempnam() returns odd filenames when urls have parameters

Reported by: Denis-de-Bernardy Owned by: dd32
Milestone: 2.9 Priority: low
Severity: minor Version: 2.8
Component: Filesystem API Keywords: has-patch commit
Focuses: Cc:

Description

it still works fine, but...

var_dump(wp_tempnam('http://foo.com/bar.zip?foo=bar&foo2=bar2'));
// /path/to/wp-content/bar.zipfoobarfoo2bar2

Attachments (2)

10224.diff (524 bytes) - added by Denis-de-Bernardy 12 years ago.
10224.2.diff (469 bytes) - added by dd32 12 years ago.

Download all attachments as: .zip

Change History (9)

#1 @Denis-de-Bernardy
12 years ago

we might want to change sanitize_filename in such a way that when a ? is encountered, it turns the likes of bar.zip?foo=bar&foo2=bar2 into bar.foo.bar.foo2.bar2.zip. That way we at least get the extension right.

#2 @dd32
12 years ago

What difference does it make with the file extension?

Chances are, If the url has url args, Its going to be a dynamic file anyway..

Its a temporary file.. It could be md5(time()) in reality

#3 @Denis-de-Bernardy
12 years ago

  • Keywords has-patch needs-review added; needs-patch removed
  • Milestone changed from Future Release to 2.9

not much difference in practice, it's just ugly in the wp-content folder.

attached file makes them all .tmp

@dd32
12 years ago

#4 @dd32
12 years ago

attachment 10224.2.diff added

not much difference in practice, it's just ugly in the wp-content folder.

The temporary files should be deleted from the wp-content folder as well, So the end user shouldnt really ever see it..

#5 @Denis-de-Bernardy
12 years ago

  • Keywords commit added; needs-review removed
  • Milestone changed from 2.9 to 2.8.1
  • Version set to 2.8

Still, there probably are cases that we've missed where they're not deleted. This would be nice to have in 2.8.1.

#6 @azaozz
12 years ago

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

(In [11712]) Improve temp file name, props DD32, fixes #10224

#7 @azaozz
12 years ago

  • Milestone changed from 2.8.2 to 2.9
Note: See TracTickets for help on using tickets.