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

Images are being slugified with file extension added to file name #1509

Closed
beckysoll opened this Issue Jul 19, 2017 · 7 comments

Comments

Projects
None yet
3 participants
@beckysoll

beckysoll commented Jul 19, 2017

Expected behaviour

Uploading an image that is already slugified shouldn't change anything about the filename.

Actual behaviour

The file extension is being added to the end of the name. Underscores are also converting to dashes.

Steps to reproduce

  1. upload an image named image_dude.png
  2. you'll see the image becomes image-dudepng.png

Server Details

Operating System: MacOS 10.12.5

Web Server: Apache

PHP Version: 5.6.2.1 (prod) and 7.0.8 (locally)

Statamic Version: 2.6

Updated from an older Statamic or fresh install: updated

@lukeagsmith

This comment has been minimized.

lukeagsmith commented Jul 19, 2017

I can confirm this is happening too (macOS with Valet).

For us, this stops us updating our clients to 2.6 as, even if they upload sensible filenames, it appends the extension to the name and we don't want them to end up with a bunch of those in their assets.

Is there a fix we could put in place before 2.6.1 so we can get 2.6 rolled out?

I also support not converting underscores to dashes.

@beckysoll

This comment has been minimized.

beckysoll commented Jul 19, 2017

I should also add, it made existing paths, referenced in content, to images that had already been uploaded prior to 2.6 invalid, as they had underscores which had been changed to dashes.

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Jul 19, 2017

I don't understand your last comment, @beckysoll
How would it affect images that have been already uploaded?

@beckysoll

This comment has been minimized.

beckysoll commented Jul 19, 2017

@jasonvarga the file name changed, the underscore that had been in the filename prior to upgrade got changed to a dash, but the reference to it in the page content referred to the old filename (i wouldn't expect that part to automatically update, i just also wouldn't expect existing image filenames to change)

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Jul 19, 2017

Chatted with Becky in Slack.

Issue there is that there was a file uploaded in 2.5 that was unaffected by the slugified changes.
The image was deleted and re-uploaded in an attempt to replace it. In 2.6 the filename ends up slightly different, thus throwing off the content.

@jasonvarga

This comment has been minimized.

Member

jasonvarga commented Jul 19, 2017

In 2.6.1, the filename will not add the extension, and will leave underscores intact.

@lukeagsmith Here's the patch:

https://gist.github.com/jasonvarga/996caf5f9a1199eba88fc4c5200ea2d9

@lukeagsmith

This comment has been minimized.

lukeagsmith commented Jul 20, 2017

The fix works well, thank you.

For my tastes, I would also like to see the filenames be lowercased as part of the slugification.

How do others feel about that?

@jasonvarga jasonvarga closed this Jul 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment