• Resolved SonalM

    (@sonalm)


    Hi there, is it possible to disable overwriting duplicate filenames and simply renaming them? Our editors sometimes upload images with the same filename and instead of renaming it to name(2).jpg it’ll just overwrite name.jpg causing confusion.

    E.g. name.jpg is uploaded
    and then another name.jpg is uploaded later, ideally this one should upload to Spaces as name(2).jpg, WordPress itself auto-corrects this within its media panel.

    • This topic was modified 6 years, 6 months ago by SonalM.
Viewing 8 replies - 1 through 8 (of 8 total)
  • I can confirm this bug. This bug exists.

    @sonalm In the meantime you can use this trick until the developer patches it.

    Goto, do-spaces-sync/code/filters.php

    Change wp_generate_attachment_metadata to wp_update_attachment_metadata

    Thread Starter SonalM

    (@sonalm)

    Hi, thank you very much Arijit, great fix!

    This works fine but it doesn’t work when the following option is selected:

    View post on imgur.com

    I’ve tried to figure out why but can’t crack it. If you happen to know why please let me know as it’d be a great help. Otherwise I’ll try and debug it.

    It seems that this dos_storage_file_only is being used for that option

    I am using the same options as yours, works fine to me!

    Thread Starter SonalM

    (@sonalm)

    Oh I see, that is very strange. What version of the plugin are you using?

    The latest version.
    I will test it one more time after a few hours. Hang on!

    @sonalm Yes. You are right. changing the filter does not solve the problem.

    @keeross Please look into it. It’s a serious issue.

    @sonalm. I figured out the problem, while wordpress uploads a new file it first check if the same named file has been uploaded before, if it does it’s add a number at the end using the wp_unique_filename() function.

    What happens is when we are only storing the file in DO Spaces, the actual wordpress folder is empty, that’s why wordpress thinks that the same file does not exist therefore it uploaded to Spaces and Spaces overwrite it with the old file.

    I think this problem can be solved by using doesObjectExist() of aws class and apply the same function the wordpress does.

    Waiting for reply from @keeross

    Plugin Author keeross

    (@keeross)

    Fixed this in v.2, will release in a couple of days.
    Testing.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Disable duplicate overwrite’ is closed to new replies.