Skip to content

Conversation

@himself65
Copy link
Contributor

@himself65 himself65 commented Apr 16, 2025

Upstream: run-llama/LlamaIndexTS#1855

fs.existSync(path) will assume path is a posix/win32 format if you give a string, so you will need pass url.pathname

@himself65
Copy link
Contributor Author

himself65 commented Apr 21, 2025

/cc @xenova do you have a change to look at this? /

@xenova
Copy link
Collaborator

xenova commented Apr 21, 2025

Hi @himself65 👋 Can you give an example of a URL which has this problem? The if clause should not allow invalid URLs to pass this step.

@himself65
Copy link
Contributor Author

himself65 commented Apr 21, 2025

Hi @himself65 👋 Can you give an example of a URL which has this problem? The if clause should not allow invalid URLs to pass this step.

Yes, we were using file: protocol in node.js, and file protocol is a standard in node.js. And this is a regression because our test is working in <=4.0.0

const imageUrl = new URL(
  "../../fixtures/img/llamaindex-white.png",
  import.meta.url,
);

const nodes = [
  new ImageNode({
    image: imageUrl,
  }),
];

@himself65
Copy link
Contributor Author

@xenova
Copy link
Collaborator

xenova commented Apr 24, 2025

That's a valid use-case, thanks for reporting! This will be merged in v3.5.1 💪

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Collaborator

@xenova xenova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@xenova xenova merged commit 06ebe86 into huggingface:main Apr 30, 2025
4 checks passed
@himself65 himself65 deleted the fix-fs branch May 20, 2025 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants