Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm hosting an image server where my clients upload their photos for viewing by their customers later. We've migrated our site from a Windows server to Linux. Some of our clients are accustomed to being able to use parenthesis in the file names. This used to work in our Windows environment but not in the Apache/Linux environment we moved to, we get a 404. When we modify the file, removing the parenthesis, we are able to serve it. Is there a way we can allow parenthesis in the file name for Apache to serve?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

That's because parenthesis are reserved by RFC 3986, and aren't allowed. You will need to percent encode these characters if you wish to use them in your URL.

URIs include components and subcomponents that are delimited by
characters in the "reserved" set.  These characters are called
"reserved" because they may (or may not) be defined as delimiters by
the generic syntax, by each scheme-specific syntax, or by the
implementation-specific syntax of a URI's dereferencing algorithm.
If data for a URI component would conflict with a reserved
character's purpose as a delimiter, then the conflicting data must be
percent-encoded before the URI is formed.

   reserved    = gen-delims / sub-delims

   gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"

   sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
               / "*" / "+" / "," / ";" / "="

If you're getting a 404, its because its not encoded and isn't actually looking at the right file, because the parens are being interpreted as delimiters. What you want to do is, assuming you have a file some_image_(huzzah), you would need to express it as some_image_%28huzzah%29 in the URI.

share|improve this answer
1  
+1 - definitely an input sanitation problem. –  Tim Brigham Oct 25 '11 at 19:00
    
I agree with timbringham's assessment. We've removed several developers, including a lead, and are now fighting several sanitization problems. However, our customers still have to do business. I've advised our new lead to escape the link he sends for the images. Thanks! –  peg_leg Oct 26 '11 at 13:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.