?
avatar yozmag
yozmag
28 Jan 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.

avatar yozmag yozmag - open - 28 Jan 2015
avatar jissues-bot jissues-bot - change - 28 Jan 2015
Labels Added: ?
avatar Bakual
Bakual - comment - 28 Jan 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.

avatar yozmag
yozmag - comment - 28 Jan 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.

avatar Bakual
Bakual - comment - 28 Jan 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 :blush:

avatar zero-24 zero-24 - change - 28 Jan 2015
Category Libraries
avatar prasoon2211
prasoon2211 - comment - 30 Jan 2015

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.
avatar yozmag
yozmag - comment - 30 Jan 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.

avatar brianteeman
brianteeman - comment - 30 Jan 2015

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/

avatar yozmag
yozmag - comment - 30 Jan 2015

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

avatar zero-24
zero-24 - comment - 30 Jan 2015

@yozmag it was 3.2.0.

320

avatar yozmag
yozmag - comment - 30 Jan 2015

Thank you.

avatar yozmag yozmag - close - 30 Jan 2015
avatar yozmag yozmag - close - 30 Jan 2015
avatar yozmag yozmag - change - 30 Jan 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-01-30 15:25:15

Add a Comment

Login with GitHub to post a comment