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
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
[Commits](https://github.com/scalableminds/webknossos/compare/24.11.1...HEAD)

### Added
- When exploring remote URIs pasted from Neuroglancer, the format prefixes like `precomputed://` are now ignored, so users don’t have to remove them. [#8195](https://github.com/scalableminds/webknossos/pull/8195)

### Changed
- Reading image files on datastore filesystem is now done asynchronously. [#8126](https://github.com/scalableminds/webknossos/pull/8126)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,15 @@ function AddRemoteLayer({
};

function validateUrls(userInput: string) {
const removePrefix = (value: string, prefix: string) =>
value.startsWith(prefix) ? value.slice(prefix.length) : value;

// If pasted from neuroglancer, uris have these prefixes even before the protocol. The backend ignores them.
userInput = removePrefix(userInput, "zarr://");
userInput = removePrefix(userInput, "zarr3://");
userInput = removePrefix(userInput, "n5://");
userInput = removePrefix(userInput, "precomputed://");

if (userInput.startsWith("https://") || userInput.startsWith("http://")) {
setSelectedProtocol("https");
} else if (userInput.startsWith("s3://")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ class ExplorativeAnnotationsView extends React.PureComponent<Props, State> {
</div>
<div className="flex-container">
<div className="flex-item" style={{ flexGrow: 0 }}>
{teamTags.length > 0 ? <TeamOutlined className="icon-margin-right"/> : null}
{teamTags.length > 0 ? <TeamOutlined className="icon-margin-right" /> : null}
</div>
<div className="flex-item">{teamTags}</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,15 @@ trait ExploreLayerUtils extends FoxImplicits {
}

def removeHeaderFileNamesFromUriSuffix(uri: String): String =
if (uri.endsWith(N5Header.FILENAME_ATTRIBUTES_JSON)) uri.dropRight(N5Header.FILENAME_ATTRIBUTES_JSON.length)
else if (uri.endsWith(ZarrHeader.FILENAME_DOT_ZARRAY)) uri.dropRight(ZarrHeader.FILENAME_DOT_ZARRAY.length)
else if (uri.endsWith(NgffMetadata.FILENAME_DOT_ZATTRS)) uri.dropRight(NgffMetadata.FILENAME_DOT_ZATTRS.length)
else if (uri.endsWith(NgffGroupHeader.FILENAME_DOT_ZGROUP))
uri.dropRight(NgffGroupHeader.FILENAME_DOT_ZGROUP.length)
else if (uri.endsWith(PrecomputedHeader.FILENAME_INFO)) uri.dropRight(PrecomputedHeader.FILENAME_INFO.length)
else if (uri.endsWith(Zarr3ArrayHeader.FILENAME_ZARR_JSON))
uri.dropRight(Zarr3ArrayHeader.FILENAME_ZARR_JSON.length)
else uri
uri
.stripSuffix(N5Header.FILENAME_ATTRIBUTES_JSON)
.stripSuffix(ZarrHeader.FILENAME_DOT_ZARRAY)
.stripSuffix(NgffMetadata.FILENAME_DOT_ZATTRS)
.stripSuffix(NgffGroupHeader.FILENAME_DOT_ZGROUP)
.stripSuffix(PrecomputedHeader.FILENAME_INFO)
.stripSuffix(Zarr3ArrayHeader.FILENAME_ZARR_JSON)

def removeNeuroglancerPrefixesFromUri(uri: String): String =
uri.stripPrefix("zarr3://").stripPrefix("zarr://").stripPrefix("precomputed://").stripPrefix("n5://")

}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ExploreRemoteLayerService @Inject()(dataVaultService: DataVaultService,
reportMutable: ListBuffer[String])(
implicit ec: ExecutionContext): Fox[List[(DataLayerWithMagLocators, VoxelSize)]] =
for {
uri <- tryo(new URI(removeHeaderFileNamesFromUriSuffix(layerUri))) ?~> s"Received invalid URI: $layerUri"
uri <- tryo(new URI(removeNeuroglancerPrefixesFromUri(removeHeaderFileNamesFromUriSuffix(layerUri)))) ?~> s"Received invalid URI: $layerUri"
_ <- bool2Fox(uri.getScheme != null) ?~> s"Received invalid URI: $layerUri"
_ <- assertLocalPathInWhitelist(uri)
credentialOpt: Option[DataVaultCredential] <- Fox.runOptional(credentialId)(remoteWebknossosClient.getCredential)
Expand Down