• Hi, I have been using this plugin for a while and it has worked well. However recently it has started throwing an error when you try to create a redirect saying the URL already exists as a redirect.

    It then only allows you to save it as a draft. However if you do save it as a draft, the publish option appears and you can then save it successfully.

    Has anyone else seen this behaviour? Can anyone suggest a solution?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bsaltd

    (@bsaltd)

    I have managed to fix this.

    The logic in the following code is redirects.js from line 111 was incorrectly returning false

    if ( 1 === data ) {
    $(‘#message’).html( ” ).hide();
    publishBtn.prop(‘disabled’, false);
    console.log(‘DATA =’, JSON.stringify(data));
    } else if ( 0 === data ) {
    $(‘#message’).html( <p>${redirectValidation.urlError}</p> ).show();
    } else {
    $(‘#message’).html( <p>${redirectValidation.fail.replace( '%s', data )}</p> ).show();
    }
    }
    });

    It seems that the variable data had a stray \r\n before it causing the === to fail. Changed the test to == and it fixed the issue.

    I couldnt work out where the stray characters were coming form though

    • This reply was modified 4 months, 2 weeks ago by bsaltd.
    • This reply was modified 4 months, 2 weeks ago by bsaltd.
    Plugin Contributor Jeffrey Paul

    (@jeffpaul)

    Thanks for the report, I’ve added this to our GitHub issue here: https://github.com/10up/safe-redirect-manager/issues/389#issuecomment-3805690250.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.