Announcement

Collapse
No announcement yet.

Shadows Imagemachine bug. -- Fails if image filename contains spaces.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ids
    replied
    Filenames and product codes are different animals. Product codes are entered into the db/table and can be validated immediately. Image filenames may also be entered, but AFAIK, wouldn't enter the table until after the file has already been uploaded. Validating the filename could have some logistic implications. But also, the filename may not be invalid to the OS. Bottom line, the filename problem really needs to fixed at the source.

    Scott

    Leave a comment:


  • William Davis
    replied
    Originally posted by lesliekirk View Post
    Good to know. I have tried for YEARS to get clients to not leave spaces in any file name but I can't seem to get through to all of them...
    It's not that people don't know, they simply forget or overlooked when copying and pasting data to save time. Image Machine, Product Code should have space and special character validation. It is a constant problem in-house and it creates a lot of problems and no easy fixes, its laborious and time consuming.
    Last edited by William Davis; 01-18-22, 01:50 PM.

    Leave a comment:


  • lesliekirk
    replied
    Good to know. I have tried for YEARS to get clients to not leave spaces in any file name but I can't seem to get through to all of them...

    Leave a comment:


  • Matt Zimmermann
    replied
    Hi Ray,

    Thanks for posting this. The issue will be addressed in the next Shadows release.

    Leave a comment:


  • Shadows Imagemachine bug. -- Fails if image filename contains spaces.

    FYI for anyone that encounters this.

    In the following Part of the Shadows ImageMachine Head Template:

    Code:
    let InitializePhotoViewer = function (clickedImage) {
    if (images.length === 1) {
    PhotoViewerControls.classList.add('u-invisible');
    }
    console.log(images.length);
    
    for (let i = 0; i < images.length; i++) {
    if (images[i].hasOwnProperty('imageSrc')) {
    if (clickedImage.includes(images[i].imageSrc)) {
    OpenPhotoViewer(images[i]);
    }
    }
    }
    };
    This fails
    Code:
    if (clickedImage.includes(images[i].imageSrc))
    because clickedImage contains spaces encoded as "%20" and images[i].imageSrc contains spaces.

    Fix:
    Code:
    if ( decodeURI( clickedImage ).includes( decodeURI( images[i].imageSrc ) ) ) {
Working...
X