Opened 11 years ago
Closed 7 years ago
#27364 closed defect (bug) (duplicate)
Attachments cannot be imported if hosted locally
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 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 (5)
#2
@
11 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
@
11 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
- URL is not of scheme http or https
- If the URL contains a HTTP username or password in it (eg. http://user:pass@example.com/)
- URL is external and has a port number which is not 80, 443 or 8080
- URL is same as home URL but its port number neither matches the previous condition nor the home URL's port (eg. home URL - http://example.com:9000 and requested URL is http://example.com:9001)
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.
Previously: #24823