Skip to content

Commit

Permalink
fix(docs): ✏️ Adding comments
Browse files Browse the repository at this point in the history
Signed-off-by: Nishant Arora <1895906+whizzzkid@users.noreply.github.com>
  • Loading branch information
whizzzkid committed Aug 16, 2023
1 parent 832679d commit 5e22cea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion add-on/src/lib/redirect-handler/blockOrObserve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ function escapeURLRegex (str: string): string {
}

/**
* Compute the namespace from the URL.
* Compute the namespace from the URL. This finds the first path segment.
* e.g. http://<gateway>/<namespace>/path/to/file/or/cid
*
* @param url string
*/
function computeNamespaceFromUrl (url: string): string {
const { pathname } = new URL(url)
// regex to match the first path segment.
return (/\/([^/]+)\//i.exec(pathname)?.[1] ?? '').toLowerCase()
}

Expand Down

0 comments on commit 5e22cea

Please sign in to comment.