[PR #2435] [MERGED] fix(caldav): Replace href with pathname from parseURL for api base #4140

Closed
opened 2026-03-22 15:04:32 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2435
Author: @mdrkrg
Created: 3/21/2026
Status: Merged
Merged: 3/22/2026
Merged by: @kolaente

Base: mainHead: fix/caldav-api-base


📝 Commits (1)

  • f1b5cd8 fix(caldav): Replace href with pathname from parseURL for api base

📊 Changes

1 file changed (+6 additions, -5 deletions)

View changed files

📝 frontend/src/stores/config.ts (+6 -5)

📄 Description

Looking at the source code of ufo.parseURL:

export function parseURL(input = "", defaultProto?: string): ParsedURL {
  const _specialProtoMatch = input.match(
    /^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i,
  );
  if (_specialProtoMatch) {
    const [, _proto, _pathname = ""] = _specialProtoMatch;
    return {
      protocol: _proto.toLowerCase(),
      pathname: _pathname,
      href: _proto + _pathname,
      auth: "",
      host: "",
      search: "",
      hash: "",
    };
  }
  // ...

  return {
    protocol: protocol.toLowerCase(),
    auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "",
    host,
    pathname,
    search,
    hash,
    [protocolRelative]: !protocol,
  };
}

parseURL only return href for special protocols (blob, data, javascript, vbscript). For API_BASE, href will be undefined.

As a consequence, the computed apiBase will always be root path. For example: https://try.vikunja.io/. This is never a problem for standard deployments though, but when I'm trying to host it on some path prefix (e.g., /vikunja), the CalDAV URL would be wrong.

The patch usees pathname from ufo.parseURL which will not be undefined.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2435 **Author:** [@mdrkrg](https://github.com/mdrkrg) **Created:** 3/21/2026 **Status:** ✅ Merged **Merged:** 3/22/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix/caldav-api-base` --- ### 📝 Commits (1) - [`f1b5cd8`](https://github.com/go-vikunja/vikunja/commit/f1b5cd8082bc7e4b65c161f22ab390aa5ed879e7) fix(caldav): Replace href with pathname from parseURL for api base ### 📊 Changes **1 file changed** (+6 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/stores/config.ts` (+6 -5) </details> ### 📄 Description Looking at the source code of `ufo.parseURL`: ```ts export function parseURL(input = "", defaultProto?: string): ParsedURL { const _specialProtoMatch = input.match( /^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i, ); if (_specialProtoMatch) { const [, _proto, _pathname = ""] = _specialProtoMatch; return { protocol: _proto.toLowerCase(), pathname: _pathname, href: _proto + _pathname, auth: "", host: "", search: "", hash: "", }; } // ... return { protocol: protocol.toLowerCase(), auth: auth ? auth.slice(0, Math.max(0, auth.length - 1)) : "", host, pathname, search, hash, [protocolRelative]: !protocol, }; } ``` `parseURL` only return `href` for special protocols (blob, data, javascript, vbscript). For API_BASE, `href` will be undefined. As a consequence, the computed `apiBase` will always be root path. For example: `https://try.vikunja.io/`. This is never a problem for standard deployments though, but when I'm trying to host it on some path prefix (e.g., `/vikunja`), the CalDAV URL would be wrong. The patch usees `pathname` from `ufo.parseURL` which will not be undefined. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-22 15:04:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#4140