mirror of
https://github.com/apple/pkl.git
synced 2026-01-14 15:43:41 +01:00
[PR #1087] [MERGED] Treat opaque file URIs as errors #882
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/1087
Author: @bioball
Created: 6/3/2025
Status: ✅ Merged
Merged: 6/3/2025
Merged by: @bioball
Base:
main← Head:invalid-file-uri📝 Commits (2)
38dec64Treat opaque file URIs as errors3862682Polish📊 Changes
16 files changed (+109 additions, -9 deletions)
View changed files
📝
pkl-core/src/main/java/org/pkl/core/ast/expression/unary/ImportGlobNode.java(+2 -2)📝
pkl-core/src/main/java/org/pkl/core/module/ModuleKeyFactories.java(+1 -1)📝
pkl-core/src/main/java/org/pkl/core/module/ModuleKeys.java(+15 -2)📝
pkl-core/src/main/java/org/pkl/core/project/ProjectPackager.java(+2 -2)📝
pkl-core/src/main/java/org/pkl/core/resource/ResourceReaders.java(+7 -1)📝
pkl-core/src/main/java/org/pkl/core/util/GlobResolver.java(+6 -1)📝
pkl-core/src/main/java/org/pkl/core/util/IoUtils.java(+6 -0)📝
pkl-core/src/main/resources/org/pkl/core/errorMessages.properties(+7 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidFileUri1.pkl(+1 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidFileUri2.pkl(+1 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidFileUri3.pkl(+1 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/input/errors/invalidFileUri4.pkl(+9 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidFileUri1.err(+13 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidFileUri2.err(+12 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidFileUri3.err(+13 -0)➕
pkl-core/src/test/files/LanguageSnippetTests/output/errors/invalidFileUri4.err(+13 -0)📄 Description
Opaque file URIs are URIs whose scheme-specific part does not start with
/.For example,
file:foo/bar.txtis an opaque URI.Currently, this has the unintentional behavior of: look for file
foo/bar.txtfrom the process working directory.These are effectively dynamics imports; from a single import, we can't statically analyze what it resolves as.
According to RFC-8089, File URIs must have paths that start with
/. So, these are actually not valid URIs.See the grammar defined in https://datatracker.ietf.org/doc/html/rfc8089#section-2
This changes Pkl's behavior so that these URIs are treated as errors.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.