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

Assets from github can't be fetched #378

Open
zaaakher opened this issue Jul 10, 2024 · 5 comments
Open

Assets from github can't be fetched #378

zaaakher opened this issue Jul 10, 2024 · 5 comments
Labels
maybe Undecided if this work should be done

Comments

@zaaakher
Copy link
Contributor

In an attempt to work around #377 I went to github.com and edit my note.md file and uploaded a gif to it. And it looks and works fine on github 👇

image

But when I go to lumen to view that same note it seems the asset isn't being displayed because it keeps facing a network error when fetching them.

image

@zaaakher
Copy link
Contributor Author

Ok my workaround here works after changing the link to the asset for an actual URL to a path to the asset in uploads folder

image

@colebemis
Copy link
Member

Oh interesting. I wonder if the github.com image is protected (because I'm assuming your notes repo is private) and Lumen isn't attaching a token when requesting that asset.

@zaaakher
Copy link
Contributor Author

@colebemis ah you're right, I think this issue is only with private repos.

We could perhaps add a condition if the image src has github.com in it. But I'm not sure how we can attach the github auth token to the image request.

function Image(props: React.ComponentPropsWithoutRef<"img">) {
// Render local files with FilePreview
if (props.src?.startsWith("/")) {
return (
<Link
to={`/file?${qs.stringify({ path: props.src })}`}
target="_blank"
className="block w-fit !no-underline"
>
<FilePreview path={props.src} alt={props.alt} />
</Link>
)
}
// eslint-disable-next-line jsx-a11y/alt-text
return <img {...props} />
}

@colebemis colebemis added the maybe Undecided if this work should be done label Jul 28, 2024
@colebemis
Copy link
Member

This would be a nice enhancement if it's an easy change but I'm not sure it's worth the effort if it's hard, since Lumen already supports direct image uploads on private repos.

@navigator8
Copy link

Just learnt something. I dis not about image support in notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maybe Undecided if this work should be done
Projects
Status: No status
Development

No branches or pull requests

3 participants