Skip to content

Commit

Permalink
fix: fix split equal symbol bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eyebrowkang committed Jul 16, 2024
1 parent f902409 commit 4ed2641
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/peerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const PeerCard = forwardRef<PeerCardRef, PeerCardProps>(
</Button>
<Textarea
rows={transformedText.split('\n').length + 1}
className="base-input font-mono"
className="font-mono"
value={transformedText}
readOnly
></Textarea>
Expand Down
6 changes: 5 additions & 1 deletion src/lib/wg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export function parseToWgConf(text: string): WireGuardConfig {
continue;
}

const [key, value] = line.split('=').map((part) => part.trim());
const firstEqualIndex = line.indexOf('=');
if (firstEqualIndex === -1 || firstEqualIndex === line.length - 1) continue;

const key = line.slice(0, firstEqualIndex).trim();
const value = line.slice(firstEqualIndex + 1).trim();

if (currentPeer) {
// Peer section
Expand Down

0 comments on commit 4ed2641

Please sign in to comment.