Skip to content

Commit

Permalink
fix: Throw error when multi-model URL is input (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanRynne authored Feb 26, 2024
1 parent b033cfa commit 92fc894
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions speckle/helpers/ParseStreamUrl.pqm
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,30 @@ let
let
streamId = segments{1},
modelList = segments{3},
isMultimodel = Text.Contains(modelList, ","),
firstModel = Text.Split(modelList, ","){0},
modelAndVersion = Text.Split(firstModel, "@"),
modelId = modelAndVersion{0},
versionId = if (List.Count(modelAndVersion) > 1) then modelAndVersion{1} else null,
model = if (modelId <> null) then GetModel(server, streamId, modelId) else null,
urlType = GetUrlType(model[name], versionId, null)
in
[
urlType = urlType,
server = server,
id = streamId,
branch = model[name],
commit = versionId,
object = null
]
if isMultimodel then
error
Error.Record(
"NotSupported",
"Multi-model URLs are not supported.",
"Try to select just one single model in the web app and paste that in."
)
else
[
urlType = urlType,
server = server,
id = streamId,
branch = model[name],
commit = versionId,
object = null
]
in
(url as text) as record =>
let
Expand Down

0 comments on commit 92fc894

Please sign in to comment.