WordPress.org

Make WordPress Core

Opened 16 months ago

Closed 16 months ago

Last modified 15 months ago

#43908 closed defect (bug) (fixed)

Export keeps generating new .zip files on Windows installations

Reported by: xkon Owned by: 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 16 months ago.
43908.diff (529 bytes) - added by xkon 16 months ago.
43908.2.diff (1.0 KB) - added by xkon 16 months ago.
43908.3.diff (1.2 KB) - added by pmbaldha 16 months ago.
Refreshed patch
test.png (32.6 KB) - added by pmbaldha 16 months ago.
Test result

Download all attachments as: .zip

Change History (24)

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


16 months ago

#2 @desrosj
16 months ago

  • Milestone changed from Awaiting Review to 4.9.6

@xkon
16 months ago

#3 @xkon
16 months 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.


16 months ago

#5 @allendav
16 months 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
16 months ago

#6 @xkon
16 months 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.


16 months ago

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


16 months ago

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


16 months ago

@pmbaldha
16 months ago

Refreshed patch

#10 @pmbaldha
16 months ago

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

@pmbaldha
16 months ago

Test result

#11 @pmbaldha
16 months 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.


16 months ago

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


16 months ago

#14 @desrosj
16 months ago

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

#15 @SergeyBiryukov
16 months 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
16 months 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
16 months ago

Follow-up: #44038

Last edited 16 months ago by SergeyBiryukov (previous) (diff)

#18 @desrosj
15 months 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.


15 months ago

Note: See TracTickets for help on using tickets.