Skip to content

Commit f3a3ded

Browse files
authored
When determining mag realpaths, treat schemeless uris as local (#8804)
Path.of fails for URIs without scheme. We want to assume local files in this case. I don’t like that this is encoded with null and we need to check this in so many places. Refactoring issue for that: #8762 ### Steps to test: - In a datasource-properties.json, add a mag with a path that is absolute and inside of the organization dir. - Dataset scanning should not report `Failed to determine real paths of mags of <ds>`. Realpaths should be set correctly in the DB. ------ - [x] Considered [common edge cases](../blob/master/.github/common_edge_cases.md) - [x] Needs datastore update after deployment
1 parent 3ea5b60 commit f3a3ded

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

webknossos-datastore/app/com/scalableminds/webknossos/datastore/services/DataSourceService.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class DataSourceService @Inject()(
138138
if (isRemote) {
139139
MagPathInfo(dataLayer.name, mag.mag, magURI.toString, magURI.toString, hasLocalData = false)
140140
} else {
141-
val magPath = Path.of(magURI)
141+
val magPath = Path.of(magURI.getPath)
142142
val realPath = magPath.toRealPath()
143143
// Does this dataset have local data, i.e. the data that is referenced by the mag path is within the dataset directory
144144
val isLocal = realPath.startsWith(datasetPath.toAbsolutePath)
@@ -159,7 +159,7 @@ class DataSourceService @Inject()(
159159
layerPath.getFileName.toString,
160160
mag
161161
)
162-
(uri, DataVaultService.isRemoteScheme(uri.getScheme))
162+
(uri, uri.getScheme != null && DataVaultService.isRemoteScheme(uri.getScheme))
163163
}
164164

165165
private def resolveRelativePath(basePath: Path, relativePath: Path): Path =

0 commit comments

Comments
 (0)