Bug found while saving the backup file path
-
Hi,
While I used your plugin in windows environment using wamp server I found a bug that has to do with the saved backup file path in db. Because the file path include (\) backslashes that can not be saved in database without a fix in your code.
For example:
The path C:\wamp64\www\wordpress/wp-content/ew-backup/dir/filename.jpg will be saved in db like: C:wamp64wwwwordpress/wp-content/ew-backup/dir/filename.jpgAs you can see it’s not able to retrieve the correct file path and when the user try to restore the file he gets an error.
There are 2 ways to solve this problem:
In file: easy-watermark/src/class/Backup/LocalBackupper.php before line 62 (update_post_meta( $attachment_id, ‘_ew_backup_file’, $new_filepath ); you must add:
a) $new_filepath = str_replace( ‘\\’, ‘/’, $new_filepath ); in order to replace all backslashes with forwardslashes, or
b) $new_filepath = esc_sql( $new_filepath ); which will replace all \ with \\ and thus the file path will be correctly saved in meta_value field.
Please update your code.
Thanks
The topic ‘Bug found while saving the backup file path’ is closed to new replies.