Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions unreleased_changes/8720.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### Fixed
- Fixed a bug where the checks on relative paths were too strict when editing dataset settings.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,10 @@ class DataSourceService @Inject()(
val uri = new URI(pathStr)
if (DataVaultService.isRemoteScheme(uri.getScheme)) true
else {
val path = Path.of(new URI(pathStr).getPath).normalize().toAbsolutePath
val path = organizationDir
.resolve(dataSource.id.directoryName)
.resolve(Path.of(new URI(pathStr).getPath).normalize())
.toAbsolutePath
Comment on lines +229 to +232
Copy link
Contributor

Choose a reason for hiding this comment

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

What about the directory of the layer? Like

val path = organizationDir
          .resolve(dataSource.id.directoryName)
          .resolve(dataLayerName)
          .resolve(Path.of(new URI(pathStr).getPath).normalize())
          .toAbsolutePath

Copy link
Member Author

Choose a reason for hiding this comment

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

We decided recently with @normanrz that the mag paths should be relative to the dataset.

While it is true that some jsons still exist where they are relative to the layer, and wk still allows that, we want to change that soon (possibly migrating said jsons).

I’d say for this particular edge case it is no problem if the check is still too strict

Copy link
Contributor

Choose a reason for hiding this comment

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

Just checked: Absolute and relative Paths. Both worked, but non-existent paths were accepted

val allowedParent = organizationDir.toAbsolutePath
if (path.startsWith(allowedParent)) true else false
}
Expand Down