Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload filenames with spaces. #5905

Closed
yozmag opened this issue Jan 28, 2015 · 9 comments
Closed

Upload filenames with spaces. #5905

yozmag opened this issue Jan 28, 2015 · 9 comments

Comments

@yozmag
Copy link

yozmag commented Jan 28, 2015

I am have some problems with og:image because of uploaded images with space in the filename. So could we change public static function makeSafe($file) from $regex = array('#(.){2,}#', '#[^A-Za-z0-9._- ]#', '#^.#'); to $regex = array('#(.){2,}#', '#[^A-Za-z0-9._- ]#', '#^.#','#\s#'); this would solve the problem.

@Bakual
Copy link
Contributor

Bakual commented Jan 28, 2015

The current reqex is correct.
Spaces aren't a safe character in an URL, so any files which eventually end up in an URL (like media files) should never contain them.
Thus makeSafe() removes those spaces correctly.

Now I'm not sure what the issue is you have in your code. It obviously doesn't make sense to pass an already existing file location through makeSafe(). It's meant to do during upload before storing a file.
In case of og:image you need to take the existing URL and properly encode it instead.

@yozmag
Copy link
Author

yozmag commented Jan 28, 2015

do you mean that array('#(.){2,}#', '#[^A-Za-z0-9._- ]#', '#^.#'); removes spaces? I think not. Are you shore?
I can change the img src to make it url safe, but if a make the change when I m uploading, the problem is solved in a early stage.

@Bakual
Copy link
Contributor

Bakual commented Jan 28, 2015

Ah, misunderstood you then. Ignore my comment. You are right, makeSafe doesn't remove spaces. And I even have a workaround in my own code for that 😊

@prasoon2211
Copy link

I don't really understand the issue here @yozmag. You said that you're having problems with files having spaces in the filename. But, the media manager doesn't allow the user to upload files with spaces in the filename (I just tried to do that and Joomla gave me a notice that the filename shouldn't have any spaces). So, how are you getting these files (with spaces in the filename) in the first place? Are you uploading them manually?

Anyway, I suppose, we could allow for spaces in the filename. We could either remove the spaces altogether or replace them with underscores or dashes.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5905.

@yozmag
Copy link
Author

yozmag commented Jan 30, 2015

I should have identifyed the place where this append, I'm on joomla 2.5.28, and this file is the same on 3.3.
On the article when uploading images "full article image" and "intro Image" the media manage lets us upload images with spaces.
I looked at make safe function and it does not remove spaces. My proposal is to remove the spaces in the makesafe function.

@brianteeman
Copy link
Contributor

I just double checked with 3.4beta1
You can NOT upload an image with a space in the file name either in media
manager or when uploading images "full article image" and "intro Image"

On 30 January 2015 at 14:33, yozmag notifications@github.com wrote:

I should have identifyed the place where this append, I'm on joomla
2.5.28, and this file is the same on 3.3.
On the article when uploading images "full article image" and "intro
Image" the media manage lets us upload images with spaces.
I looked at make safe function and it does not remove spaces. My proposal
is to remove the spaces in the makesafe function.


Reply to this email directly or view it on GitHub
#5905 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

@yozmag
Copy link
Author

yozmag commented Jan 30, 2015

I just found this, 3d1af35 .
How can I find the joomla version that was this changed?

@zero-24
Copy link
Member

zero-24 commented Jan 30, 2015

@yozmag it was 3.2.0.

320

@yozmag
Copy link
Author

yozmag commented Jan 30, 2015

Thank you.

@yozmag yozmag closed this as completed Jan 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants