Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Wrong tag asset URL used in fetchManifest #12

Closed
anonhostpi opened this issue Jun 24, 2024 · 0 comments · Fixed by #14
Closed

[Bug]: Wrong tag asset URL used in fetchManifest #12

anonhostpi opened this issue Jun 24, 2024 · 0 comments · Fixed by #14
Labels
bug Something isn't working

Comments

@anonhostpi
Copy link
Contributor

Describe the bug

Currently, you use this to retrieve manifest.json:

export async function fetchManifest(repository: string, tag_name?: string): Promise<PluginManifest | undefined> {
const URL = `https://raw.githubusercontent.com/${repository}/${tag_name ? tag_name : 'HEAD'}/manifest.json`;
try {
if (!repositoryRegEx.test(repository)) {
throw Error('Repository string do not match the pattern!');
}
// Do a request to the url
const response = await request({ url: URL });
// Process the response
return (await JSON.parse(response)) as PluginManifest;
}
catch (e) {
(e as Error).message = 'Failed to fetch the manifest for plugin! ' + (e as Error).message;
console.error(e);
}
}

This is the wrong URL. Obsidian uses the Release REST API and not the raw file. This is an important distinction, because the release asset and the ref/raw asset, don't have to be the same.

How to Reproduce

Try to add anonhostpi/obsidian-exposed-api and install 0.0.3-f

It fails, because the wrong manifest file was used

Expected behavior

It should use the

OS of your device

Win11

Obsidian Version

v1.6.3

Plugin Version

0.3.5

Additional context

Going to be working on a PR in a moment to fix this for ya.

@anonhostpi anonhostpi added the bug Something isn't working label Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant