• Resolved xitromedia

    (@xitromedia)


    Hi

    When i import a config .json file on windows i always get an error “Configuration file could not be imported.”. After long research i found the bug in code:

    In Generic_AdminActions_Config.php > w3tc_config_import() the temp file’s path gets unslashed:

    isset( $_FILES[‘config_file’][‘tmp_name’] ) ? esc_url_raw( wp_unslash( $_FILES[‘config_file’][‘tmp_name’] ) ) : ”

    This is wrongly done for windows because windows uses backslashes instead of forward slashes and the path to the imported temp-file is not a path anymore after the backslashes got removed with wp_unslash().

    As far as i see this piece of code was last modified in 2022, so that bus exists since 3 years.

    Thanks for fixing in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @xitromedia

    Thank you for reaching out and I am happy to help!
    Let me check this and make some tests and I’ll get back to you as soon as I have more information

    Thanks!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @xitromedia

    Thank you for your patience.
    We’ll udpate the line to: wp_normalize_path( sanitize_text_field( $_FILES['config_file']['tmp_name'] ) ) : ''
    You can try updating this yourself, or wait for the upcoming relase

    Thanks!

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

The topic ‘Error when importing config file on windows’ is closed to new replies.