{ "issue": { "url": "https://api.github.com/repos/laurent22/joplin/issues/12043", "repository_url": "https://api.github.com/repos/laurent22/joplin", "labels_url": "https://api.github.com/repos/laurent22/joplin/issues/12043/labels{/name}", "comments_url": "https://api.github.com/repos/laurent22/joplin/issues/12043/comments", "events_url": "https://api.github.com/repos/laurent22/joplin/issues/12043/events", "html_url": "https://github.com/laurent22/joplin/pull/12043", "id": 2964587386, "node_id": "PR_kwDOBLftOs6Q_r4y", "number": 12043, "title": "All: Resolves minor bug: Fixed absoluteUrl and baseUrl functions", "user": { "login": "d4m14n-gh", "id": 87342969, "node_id": "MDQ6VXNlcjg3MzQyOTY5", "avatar_url": "https://avatars.githubusercontent.com/u/87342969?v=4", "gravatar_id": "", "url": "https://api.github.com/users/d4m14n-gh", "html_url": "https://github.com/d4m14n-gh", "followers_url": "https://api.github.com/users/d4m14n-gh/followers", "following_url": "https://api.github.com/users/d4m14n-gh/following{/other_user}", "gists_url": "https://api.github.com/users/d4m14n-gh/gists{/gist_id}", "starred_url": "https://api.github.com/users/d4m14n-gh/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/d4m14n-gh/subscriptions", "organizations_url": "https://api.github.com/users/d4m14n-gh/orgs", "repos_url": "https://api.github.com/users/d4m14n-gh/repos", "events_url": "https://api.github.com/users/d4m14n-gh/events{/privacy}", "received_events_url": "https://api.github.com/users/d4m14n-gh/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "labels": [], "state": "closed", "locked": false, "assignee": null, "assignees": [], "milestone": null, "comments": 5, "created_at": "2025-04-01T21:13:09Z", "updated_at": "2025-04-07T19:25:41Z", "closed_at": "2025-04-07T19:05:37Z", "author_association": "CONTRIBUTOR", "active_lock_reason": null, "draft": false, "pull_request": { "url": "https://api.github.com/repos/laurent22/joplin/pulls/12043", "html_url": "https://github.com/laurent22/joplin/pull/12043", "diff_url": "https://github.com/laurent22/joplin/pull/12043.diff", "patch_url": "https://github.com/laurent22/joplin/pull/12043.patch", "merged_at": "2025-04-07T19:05:37Z" }, "body": "# All: Resolves minor bug: Fixed absoluteUrl function (/packages/lib/clipperUtils.ts)\r\n\r\nFixes an issue with the absoluteUrl function, which occurs when the function is invoked with a relative URL (a path-only URL).\r\nI found this bug while running my own white-box unit tests.\r\n\r\n\r\n\r\n### My own test result screen:\r\n![image](https://github.com/user-attachments/assets/639b2832-1e91-4ea9-b5cf-9935e23e34e3)\r\n\r\n### Old code with my comment:\r\n```typescript\r\nfunction absoluteUrl(url: string) {\r\n\tif (!url) return url;\r\n\tconst protocol = url.toLowerCase().split(':')[0];\r\n\tif (['http', 'https', 'file', 'data'].indexOf(protocol) >= 0) return url;\r\n\r\n\tif (url.indexOf('//') === 0) {\r\n\t\treturn location.protocol + url;\r\n\t} else if (url[0] === '/') {\r\n\t\treturn `${location.protocol}//${location.host}${url}`;\r\n\t} else {\r\n\t\treturn `${baseUrl()}/${url}`; //double '/' here: baseUrl() can ends with '/'\r\n\t}\r\n}\r\n```\r\n\r\n```typescript\r\nfunction baseUrl() {\r\n\tlet output = pageLocationOrigin() + location.pathname; //location.pathname can be \"/\" or can ends with \"/\"\r\n\tif (output[output.length - 1] !== '/') {\r\n\t\tconst output2 = output.split('/');\r\n\t\toutput2.pop();\r\n\t\toutput = output2.join('/');\r\n\t}\r\n\treturn output;\r\n}\r\n```\r\n\r\n\r\n### New version of baseUrl():\r\n```typescript\r\nfunction baseUrl() {\r\n\tlet output = pageLocationOrigin() + location.pathname;\r\n\tif (output[output.length - 1] !== '/') {\r\n\t\t\tconst output2 = output.split('/');\r\n\t\t\toutput2.pop();\r\n\t\t\toutput = output2.join('/');\r\n\t}\r\n\tif (output[output.length - 1] === '/') {\r\n\t\t\toutput = output.slice(0, -1);\r\n\t}\r\n\treturn output;\r\n}\r\n", "closed_by": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/12043/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "timeline_url": "https://api.github.com/repos/laurent22/joplin/issues/12043/timeline", "performed_via_github_app": null, "state_reason": null }, "comments": [ { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2770699318", "html_url": "https://github.com/laurent22/joplin/pull/12043#issuecomment-2770699318", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/12043", "id": 2770699318, "node_id": "IC_kwDOBLftOs6lJYQ2", "user": { "login": "github-actions[bot]", "id": 41898282, "node_id": "MDM6Qm90NDE4OTgyODI=", "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github-actions%5Bbot%5D", "html_url": "https://github.com/apps/github-actions", "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", "type": "Bot", "user_view_type": "public", "site_admin": false }, "created_at": "2025-04-01T21:13:21Z", "updated_at": "2025-04-07T19:25:40Z", "author_association": "CONTRIBUTOR", "body": "****CLA Assistant Lite bot**** All contributors have signed the CLA ✍️ ✅", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2770699318/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": { "id": 15368, "client_id": "Iv1.05c79e9ad1f6bdfa", "slug": "github-actions", "node_id": "MDM6QXBwMTUzNjg=", "owner": { "login": "github", "id": 9919, "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github", "html_url": "https://github.com/github", "followers_url": "https://api.github.com/users/github/followers", "following_url": "https://api.github.com/users/github/following{/other_user}", "gists_url": "https://api.github.com/users/github/gists{/gist_id}", "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/github/subscriptions", "organizations_url": "https://api.github.com/users/github/orgs", "repos_url": "https://api.github.com/users/github/repos", "events_url": "https://api.github.com/users/github/events{/privacy}", "received_events_url": "https://api.github.com/users/github/received_events", "type": "Organization", "user_view_type": "public", "site_admin": false }, "name": "GitHub Actions", "description": "Automate your workflow from idea to production", "external_url": "https://help.github.com/en/actions", "html_url": "https://github.com/apps/github-actions", "created_at": "2018-07-30T09:30:17Z", "updated_at": "2025-03-07T16:35:00Z", "permissions": { "actions": "write", "administration": "read", "attestations": "write", "checks": "write", "contents": "write", "deployments": "write", "discussions": "write", "issues": "write", "merge_queues": "write", "metadata": "read", "models": "read", "packages": "write", "pages": "write", "pull_requests": "write", "repository_hooks": "write", "repository_projects": "write", "security_events": "write", "statuses": "write", "vulnerability_alerts": "read" }, "events": [ "branch_protection_rule", "check_run", "check_suite", "create", "delete", "deployment", "deployment_status", "discussion", "discussion_comment", "fork", "gollum", "issues", "issue_comment", "label", "merge_group", "milestone", "page_build", "project", "project_card", "project_column", "public", "pull_request", "pull_request_review", "pull_request_review_comment", "push", "registry_package", "release", "repository", "repository_dispatch", "status", "watch", "workflow_dispatch", "workflow_run" ] } }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2770702602", "html_url": "https://github.com/laurent22/joplin/pull/12043#issuecomment-2770702602", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/12043", "id": 2770702602, "node_id": "IC_kwDOBLftOs6lJZEK", "user": { "login": "d4m14n-gh", "id": 87342969, "node_id": "MDQ6VXNlcjg3MzQyOTY5", "avatar_url": "https://avatars.githubusercontent.com/u/87342969?v=4", "gravatar_id": "", "url": "https://api.github.com/users/d4m14n-gh", "html_url": "https://github.com/d4m14n-gh", "followers_url": "https://api.github.com/users/d4m14n-gh/followers", "following_url": "https://api.github.com/users/d4m14n-gh/following{/other_user}", "gists_url": "https://api.github.com/users/d4m14n-gh/gists{/gist_id}", "starred_url": "https://api.github.com/users/d4m14n-gh/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/d4m14n-gh/subscriptions", "organizations_url": "https://api.github.com/users/d4m14n-gh/orgs", "repos_url": "https://api.github.com/users/d4m14n-gh/repos", "events_url": "https://api.github.com/users/d4m14n-gh/events{/privacy}", "received_events_url": "https://api.github.com/users/d4m14n-gh/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2025-04-01T21:15:08Z", "updated_at": "2025-04-01T21:15:08Z", "author_association": "CONTRIBUTOR", "body": "I have read the CLA Document and I hereby sign the CLA", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2770702602/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2771960341", "html_url": "https://github.com/laurent22/joplin/pull/12043#issuecomment-2771960341", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/12043", "id": 2771960341, "node_id": "IC_kwDOBLftOs6lOMIV", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2025-04-02T09:22:04Z", "updated_at": "2025-04-02T09:22:04Z", "author_association": "OWNER", "body": "Thank you, but normally it's the base URL that shouldn't have a trailing slash, so it's `baseUrl()` that should be fixed", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2771960341/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2772120315", "html_url": "https://github.com/laurent22/joplin/pull/12043#issuecomment-2772120315", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/12043", "id": 2772120315, "node_id": "IC_kwDOBLftOs6lOzL7", "user": { "login": "d4m14n-gh", "id": 87342969, "node_id": "MDQ6VXNlcjg3MzQyOTY5", "avatar_url": "https://avatars.githubusercontent.com/u/87342969?v=4", "gravatar_id": "", "url": "https://api.github.com/users/d4m14n-gh", "html_url": "https://github.com/d4m14n-gh", "followers_url": "https://api.github.com/users/d4m14n-gh/followers", "following_url": "https://api.github.com/users/d4m14n-gh/following{/other_user}", "gists_url": "https://api.github.com/users/d4m14n-gh/gists{/gist_id}", "starred_url": "https://api.github.com/users/d4m14n-gh/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/d4m14n-gh/subscriptions", "organizations_url": "https://api.github.com/users/d4m14n-gh/orgs", "repos_url": "https://api.github.com/users/d4m14n-gh/repos", "events_url": "https://api.github.com/users/d4m14n-gh/events{/privacy}", "received_events_url": "https://api.github.com/users/d4m14n-gh/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2025-04-02T10:23:21Z", "updated_at": "2025-04-02T10:23:21Z", "author_association": "CONTRIBUTOR", "body": "> Thank you, but normally it's the base URL that shouldn't have a trailing slash, so it's `baseUrl()` that should be fixed\r\n\r\nYou're right, my mistake. I've corrected it.", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2772120315/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2784293772", "html_url": "https://github.com/laurent22/joplin/pull/12043#issuecomment-2784293772", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/12043", "id": 2784293772, "node_id": "IC_kwDOBLftOs6l9POM", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2025-04-07T19:05:25Z", "updated_at": "2025-04-07T19:05:25Z", "author_association": "OWNER", "body": "That looks good now, thank you!", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/2784293772/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null } ] }