Skip to content

Commit 7c3f721

Browse files
Merge with upstream
2 parents 3abc866 + 61bda8d commit 7c3f721

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/api/utilities/functions.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,14 @@ function beans_url_to_path( $url, $force_rebuild = false ) {
266266
$url = 'http://' . ltrim( $url, '/' );
267267
}
268268

269+
// Stop here if it is not an internal url.
270+
if ( false === stripos( $url, parse_url( site_url(), PHP_URL_HOST ) ) ) {
271+
// If it is not an internal url we are having relative url instead.
272+
// Add ./ in front of the relative url to make it relative path.
273+
// After sanitize it will be converted to absolute path.
274+
return beans_sanitize_path( './' . $url );
275+
}
276+
269277
// It's not an internal URL. Bail out.
270278
if ( false === stripos( parse_url( $url, PHP_URL_HOST ), parse_url( $site_url, PHP_URL_HOST ) ) ) {
271279
return isset( $original_url ) ? $original_url : $url;

0 commit comments

Comments
 (0)