[Bug] Export/Import/Clone fails on apps where names contain HTML

@bravenel as I am exporting apps from one hub and importing in another as part of my C8 migration I noticed that exports from source hub fail if the app name contains HTML formatting in it such as colored words like Restricted, Stopped, Active, etc. The export button appears but after clicking it you are promoted for the app name again and fails.

Not seeing this. Just exported a few that have the colored text in the app name, no problem.

Hit Done in Export/Import/Clone and try again. You may have an instance that needs to start fresh. Always hit Done after each export.

@bravenel I was just able to reproduce this too on another hub that I had not exported apps from. One important piece of information I forgot to mention in the OP is with apps where HTML is in the name you are always prompted for the name of the app:

  1. Enter the name and click away the button shows up
  2. Click the button and download the file
  3. Notice the file is a text file and not JSON like apps where there is no HTML within the name
  4. In target hub try to import that text file and it won't find it by default since it is expecting a JSON file.

I am using a Windows PC and same results within Chrome and Firefox.

Do you have any special UTF-8 chars in the app name as well? Another user has an open thread where we discovered that he was not able to clone dashboards because some of his devices have special characters in them from another language. Never got fixed that I know of.

Show a screenshot of this. I don't know what you're doing.

What browser / OS are you using? I'm doing this with Chrome on MacOS. It doesn't have to be a JSON file, import will select any file. I don't know where you'd ever enter an app name for export.

I don't.

Here is one example of a notification rule that has a restriction and red text:

I click the Export/Import/Clone Button from the app status and am taken to the Export app:

Upon clicking the highlighted button with the app name, I am then prompted to reenter the app name:

Windows 11 and fails on both Chrome and Firefox. I have a Mac and can try with it too if you like.

That last prompt is not for the app name, it's for the file name you want to download to. It can be anything, and has nothing to do (necessarily) with the app name. The name of the app is part of the JSON text that is created.

So just what do you mean by "fail"? That it is prompting you for a file name? That's how it works.

Sorry for confusion and you are correct.

I was exporting a bunch of rules and I have many of these errors in my logs during importing of the files:
java.lang.NullPointerException: Cannot invoke method replace() on null object on line 377 (method installed)

The main issue I see is there are inconsistencies in the app between having HTML text not having it. When exporting an app without HTML text you are NOT prompted for the file name and the file is of type JSON. If the app does have HTML text within its name, you are prompted for the file name and the file is of type TEXT or sometimes just "file" (at least on Windows PC).
image

Then when importing the file on a target hub, the Browse button defaults to files of type JSON so you have to know that the file is of type TEXT to find it which creates a bit of confusion:

This is a separate issue. I will look into what might cause it.

Actually, the reason that sometimes you are prompted for a file name and sometimes you are not has nothing to do with HTML in the app name. This arises from the method by which you select the app. If you select Export/Import/Clone from a child app, it will create the file name for you and append .json to that filename. So this is showing up in Windows as JSON file (JSON is really just text). If you select a child app from the list after selecting Export/Import/Clone on the parent app, it will prompt you for a file name. You can use whatever file name you want, including .json or .txt, or no extension at all. In every case, the file created contains text. The import selector is not looking for files with any particular extension or of any particular type, irrespective of that default selection of JSON (I've never seen this, since I don't use Windows). It allows you to select whatever file it is that contains your export. Windows is being too 'helpful' in this case, unlike MacOS or Linux.

Thanks!

My wife mentioned her office light wasn't turning on automatically this morning as it is controlled by a Room Lighting rule that I moved from one hub to another. After investigating, I saw a bunch of errors in the log for that Room Lighting app. I verified the same error happens with another instance of Room Lighting that I had imported and same error:

I went into each Room Lighting instance and clicked done and the app started working. Wanted you to know in case this can be fixed during the app import process.

Unfortunately I am not experience that expected behavior. I just tested this with my Macbook and am experiencing the same exact behavior as my windows machine. I cannot upload videos so I recorded these animated Gif's that will hopefully provide you better clarity of the issue.

App without restrictions

App No Restrictions

Same App with a restriction and HTML in name

App with Restrictions

App import

App Import

Happy to jump on a Zoom to demonstrate live.

Ah, ok. I guess you have to put an extension on the filename when you create it.

Sure that will work but why is it inconsistent with an app with no HTML? Why does one app add the extension and not the other? If this cannot be fixed a warning of some sort should be added to the UI so the user is aware they won't be able to import it without an extension.