| @@ -295,38 +295,16 @@ | ||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | list( $identifier, $host ) = $identifier_and_host; |
| 298 | 298 | |
| 299 | - /* | |
| 300 | - * The resource must point at this site, or at its pre-migration host. Both sides are folded: | |
| 301 | - * the requested host is whatever the caller typed, and the stored ones are whatever an admin did. | |
| 302 | - */ | |
| 303 | - $host = normalize_host( fold_host( $host ) ); | |
| 304 | - | |
| 305 | - // A host of `.` or `[]` folds away to nothing, which would otherwise match an unset old host. | |
| 306 | - if ( '' === $host ) { | |
| 299 | + // The resource must point at this site, or at its pre-migration host. | |
| 300 | + $host = normalize_host( $host ); | |
| 301 | + if ( normalize_host( home_host() ) !== $host && normalize_host( \get_option( 'activitypub_old_host' ) ) !== $host ) { | |
| 307 | 302 | return false; |
| 308 | 303 | } |
| 309 | 304 | |
| 310 | - if ( normalize_host( fold_host( home_host() ) ) !== $host && normalize_host( fold_host( \get_option( 'activitypub_old_host' ) ) ) !== $host ) { | |
| 311 | - return false; | |
| 312 | - } | |
| 313 | - | |
| 314 | 305 | // URL forms: the REST actor ID or the pretty /@application profile path. |
| 315 | 306 | if ( false !== \strpos( $identifier, '://' ) ) { |
| 316 | - /* | |
| 317 | - * Fold the scheme and authority, which are case-insensitive, before comparing. The path | |
| 318 | - * keeps its case. Without this the host guard above accepts a spelling that this then | |
| 319 | - * rejects. | |
| 320 | - */ | |
| 321 | - $identifier = \preg_replace_callback( | |
| 322 | - '#^[a-zA-Z][a-zA-Z0-9+.\-]*://[^/?\#]+#', | |
| 323 | - static function ( $authority ) { | |
| 324 | - return \strtolower( $authority[0] ); | |
| 325 | - }, | |
| 326 | - $identifier | |
| 327 | - ); | |
| 328 | - | |
| 329 | 307 | $identifier = normalize_url( $identifier ); |
| 330 | 308 | |
| 331 | 309 | return normalize_url( self::get_id() ) === $identifier |
| 332 | 310 | || normalize_url( \home_url( '/@' . self::USERNAME ) ) === $identifier; |