Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#43908 closed defect (bug) (fixed)

Export keeps generating new .zip files on Windows installations

Reported by: xkon's profile xkon Owned by: sergeybiryukov's profile sergeybiryukov
Milestone: 4.9.6 Priority: normal
Severity: normal Version:
Component: Privacy Keywords: gdpr has-patch
Focuses: Cc:

Description

In file.php line 2146 we have update_post_meta( $request_id, '_export_file_path', $archive_pathname ); to update the filepath of the exported zip file.

In windows the file path uses \ instead of / and they get stripped out when the update_post_meta happens.

This results in an error when downloading / mailing the file so it always generates a new .zip file.

I've made a check by doing an $archive_pathname = str_replace( '\\', '/', $archive_pathname ); just before the update_post_meta and it works but not sure if that's the way to go.

( not sure if it's my installation only either but I've never seen it happen again and I was always working on Windows maybe it's an update_post_meta thing? )

Attachments (5)

xk20180430200820.jpg (68.5 KB) - added by xkon 6 years ago.
43908.diff (529 bytes) - added by xkon 6 years ago.
43908.2.diff (1.0 KB) - added by xkon 6 years ago.
43908.3.diff (1.2 KB) - added by pmbaldha 6 years ago.
Refreshed patch
test.png (32.6 KB) - added by pmbaldha 6 years ago.
Test result

Download all attachments as: .zip

Change History (24)

@xkon
6 years ago

This ticket was mentioned in Slack in #gdpr-compliance by xkon. View the logs.


6 years ago

#2 @desrosj
6 years ago

  • Milestone changed from Awaiting Review to 4.9.6

@xkon
6 years ago

#3 @xkon
6 years ago

  • Keywords has-patch added

43908.diff uses wp_normalize_path to fix \ into / that are causing the issues under windows.

Please do test, but my tests where looking good and the issues stopped.

This ticket was mentioned in Slack in #gdpr-compliance by xkon. View the logs.


6 years ago

#5 @allendav
6 years ago

This works well for the archive (ZIP) on my Mac, but I wonder if you ( @xkon ) are also having (silent) trouble on Windows with the temporary HTML report path (we write the HTML report then use it to addFile to the ZIP and then we delete the temporary HTML report)

I recommend you also dump $html_report_pathname near line 2046 in file.php and see if the path for that file is also malformed. If so, you might want to normalize it too before using it.

@xkon
6 years ago

#6 @xkon
6 years ago

@allendav you were correct. Although the file creation was working since the \ where not getting removed still there was a mix of \ + / so I added another normalize as you said in 43908.2.diff .

Works properly again without any issues.

This ticket was mentioned in Slack in #gdpr-compliance by xkon. View the logs.


6 years ago

This ticket was mentioned in Slack in #core by desrosj. View the logs.


6 years ago

This ticket was mentioned in Slack in #gdpr-compliance by allendav. View the logs.


6 years ago

@pmbaldha
6 years ago

Refreshed patch

#10 @pmbaldha
6 years ago

@desrosj The last patch was need to be refreshed. I have refreshed it.

@pmbaldha
6 years ago

Test result

#11 @pmbaldha
6 years ago

I have tested the 43908.3.diff patch and it is working fine.

This ticket was mentioned in Slack in #gdpr-compliance by sergey. View the logs.


6 years ago

This ticket was mentioned in Slack in #core by desrosj. View the logs.


6 years ago

#14 @desrosj
6 years ago

  • Owner set to sergeybiryukov
  • Status changed from new to reviewing

#15 @SergeyBiryukov
6 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 43234:

Privacy: Normalize file paths in wp_privacy_generate_personal_data_export_file() to make sure Windows paths don't have their backslashes stripped.

Props xkon, pmbaldha.
Fixes #43908.

#16 @SergeyBiryukov
6 years ago

In 43235:

Privacy: Normalize file paths in wp_privacy_generate_personal_data_export_file() to make sure Windows paths don't have their backslashes stripped.

Props xkon, pmbaldha.
Merges [43234] to the 4.9 branch.
Fixes #43908.

#17 @SergeyBiryukov
6 years ago

Follow-up: #44038

Last edited 6 years ago by SergeyBiryukov (previous) (diff)

#18 @desrosj
6 years ago

  • Component changed from General to Privacy

Moving to the new Privacy component.

This ticket was mentioned in Slack in #meta by pmbaldha. View the logs.


6 years ago

Note: See TracTickets for help on using tickets.