Remove Streams with \ instead of a /

Hi I made an error in creating branches in my stream.

I wanted to make a subbranch, but I used a \ instead of a /
image

Now it shows up as a missing Branch, which kinda exists.

What I also noticed is that in the Stream URL the \ is translated into a /, thus not refering to the correct branch?
https://rhdhv.speckle.xyz/streams/5c724be350/branches/paaldeksel/wv9

Is it possible to remove this branch? I an missing the Edit function in which I can delete it.

2 Likes

Hey @Joelmick ,

Thank you for bringing this to our attention! It looks like a really interesting papercut and we’re excited to investigate it further.

1 Like

Great, I know it is not possible via the UI. But maybe via SpecklePy? I don’t have time right now to investigate that myself, but maybe that is a solution.

GraphQL will suffice!

Login to the GraphQL explorer: Speckle GraphQL API. If you haven’t done so before, you’ll need to authenticate yourself - it’s a simple step: accept.

Once there, you can start a new query window and see the branch you’ve made:

query {
  stream(id: "YOUR_STREAM_ID") {
    branches {
      items {
        id
        name
        description
      }
    }
  }
}

You’ll see a large list, which will be all the branches on that stream. My silly example:

{
  "data": {
    "stream": {
      "branches": {
        "items": [
          {
            "id": "532da7b914",
            "name": "main",
            "description": "default branch"
          },
          {
            "id": "238122347d",
            "name": "silly backslash\\oops",
            "description": "This branch shouldn't exist"
          }
        ]
      }
    }
  }
}

There is a query that can retrieve a single branch, but this also falls foul of the naming bug you uncovered, as it requires the branch name to retrieve the branch details.

{
  stream(id: "YOUR_STREAM_ID") {
    branch(name: "silly backslash\\\\oops") {
      id
      name
    }
  }
}

the trick here is to triple escape the backslashes \\\\ to get through the stages of text parsing.

In your example, the line would be: branch(name: "paaldeksel\\\\wv9")

In either method, you’ll have a branch id

We can now perform a mutation

mutation BranchUpdate($branchDetails: BranchUpdateInput!) {
  branchUpdate(branch: $branchDetails)
}

that will be fed a variables object (you enter these in the lower section of the explorer
image

you can now define a new name for the badly slashed branch, but inputting the correct

{
  "branchDetails": {
    "streamId": "YOUR_STREAM_ID",
    "id": "238122347d",
    "name": "nice name/proper slash",
    "description": "that's better."
  }
}

Then execute image

This should return:

{
  "data": {
    "branchUpdate": true
  }
}

If you instead want to trash the branch; similar steps:

mutation BranchDelete ($branchDetails: BranchDeleteInput!) {
  branchDelete(branch: $branchDetails)
}
{
  "branchDetails": {
    "id": "238122347d",
    "streamId": "YOUR_STREAM_ID"
  }
}