Unverified Commit 7d0511b7 authored by Hong Minhee's avatar Hong Minhee
Browse files

Fix error when invalid base-url for followers collection

parent 716db0f4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -12,6 +12,11 @@ To be released.
    `acct:` URIs with a host having a port number.
    [[#218], [#219] by Revath S Kumar]

 -  Fixed a server error thrown when an invalid URL was passed to the `base-url`
    parameter of the followers collection.  [[#217]]

[#217]: https://github.com/fedify-dev/fedify/issues/217


Version 1.0.20
--------------
+6 −2
Original line number Diff line number Diff line
@@ -1910,8 +1910,12 @@ export class FederationImpl<TContextData> implements Federation<TContextData> {
      case "followers": {
        let baseUrl = url.searchParams.get("base-url");
        if (baseUrl != null) {
          const u = new URL(baseUrl);
          baseUrl = `${u.origin}/`;
          try {
            baseUrl = `${new URL(baseUrl).origin}/`;
          } catch {
            // If base-url is invalid, set to null to behave as if it wasn't provided
            baseUrl = null;
          }
        }
        return await handleCollection(request, {
          name: "followers",