WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 2 years ago

#27364 new defect (bug)

Attachments cannot be imported if hosted locally

Reported by: markjaquith Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Import Keywords: needs-patch
Focuses: Cc:

Description

If you're doing a WordPress import and you're importing attachments and the attachments are hosted locally, their import fails with "Remote server did not respond". Chased this down the rabbit hole, and it's because of reject_unsafe_urls.

See also: #24646

Change History (4)

#2 @markjaquith
4 years ago

I'd be less frustrated here if the error message were more specific than "Remote server did not respond." We have a good error message, but we bail with false and lose all that data, and thus the importer doesn't really know what happened.

#3 @jesin
4 years ago

The check for external URLs when hosted locally happens in the wp_http_validate_url() function.

This function also returns false for the following reasons

So this function has to be modified to handle errors with WP_Error.

This function applies the filter http_request_host_is_external when doing the external URL on a local setup check which can be set to true in the importer plugin to import external attachments.

#4 @chriscct7
2 years ago

  • Keywords needs-patch added
Note: See TracTickets for help on using tickets.