Skip to content

Commit

Permalink
Resolved #607 (comment)
Browse files Browse the repository at this point in the history
I resolved #607 (comment) by removing the condition
  • Loading branch information
EthanThatOneKid committed Oct 9, 2022
1 parent 2e86f85 commit 564efa8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib/server/links/utils.ts
@@ -1,7 +1,7 @@
import QRCode from 'qrcode';
import type { Link, ParsedLink } from './types';

export function parseLink(url: string): ParsedLink | undefined {
export function parseLink(url: string): ParsedLink {
const hashBeginIdx = url.lastIndexOf('#');
let hashStr = '';
if (hashBeginIdx !== -1) {
Expand Down Expand Up @@ -48,9 +48,8 @@ export function parseLinkId<ID extends string>(
separator = '/'
): Link<ID> | undefined {
const link = parseLink(url);
if (!link) return;

const id = findLinkId(link.relativePathname.split(separator), subCollection, separator);
const segments = link.relativePathname.split(separator);
const id = findLinkId(segments, subCollection, separator);
if (id === undefined) return;

const relativePathname = link.relativePathname.slice(id.length);
Expand Down

0 comments on commit 564efa8

Please sign in to comment.