Skip to content

Commit 0e9e18a

Browse files
committed
Add note to document AI generated code
1 parent 7d07c63 commit 0e9e18a

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/library/config/defaultFunctions.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { GithubPermalinkDataResponse } from "./GithubPermalinkContext";
44
import { ErrorResponses } from "./GithubPermalinkContext";
55

66
/**
7+
* This is AI generated code from GitHub Copilot.
8+
* See: https://github.com/dwjohnston/react-github-permalink/pull/79
9+
*
710
* Properly decode base64 string with UTF-8 support.
811
* GitHub API returns base64-encoded content that may contain UTF-8 characters like emojis.
912
*
@@ -16,16 +19,16 @@ import { ErrorResponses } from "./GithubPermalinkContext";
1619
function decodeBase64WithUTF8(base64: string): string {
1720
// Remove whitespace that GitHub API might include
1821
const cleanedBase64 = base64.replace(/\s/g, '');
19-
22+
2023
// Decode base64 to binary string (each character represents a byte)
2124
const binaryString = atob(cleanedBase64);
22-
25+
2326
// Convert binary string to byte array
2427
const bytes = new Uint8Array(binaryString.length);
2528
for (let i = 0; i < binaryString.length; i++) {
2629
bytes[i] = binaryString.charCodeAt(i);
2730
}
28-
31+
2932
// Decode UTF-8 bytes to string
3033
const decoder = new TextDecoder('utf-8');
3134
return decoder.decode(bytes);

0 commit comments

Comments
 (0)