Skip to content

Commit

Permalink
Boost: Create hash from URL without trailing slash (#40303)
Browse files Browse the repository at this point in the history
* Create hash from URL without trailing slash

* changelog

* Remove leading slash from URL hash

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11970922100

Upstream-Ref: Automattic/jetpack@18cc457
  • Loading branch information
haqadn authored and matticbot committed Nov 22, 2024
1 parent c771434 commit 9779e71
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public static function get_hash_for_url( $url ) {
$url = substr( $url, strlen( $home_url ) );
}

$url = ltrim( $url, '/' );
$url = untrailingslashit( $url );

$hash = hash( 'md5', $url );

return substr( $hash, 0, 8 );
Expand Down

0 comments on commit 9779e71

Please sign in to comment.