usebruno / bruno

Opensource IDE For Exploring and Testing Api's (lightweight alternative to postman/insomnia)
https://www.usebruno.com/
MIT License
25.43k stars 1.16k forks source link

Can't import a POSTMAN collection with a / char in the name #219

Open l0new4nder3r opened 11 months ago

l0new4nder3r commented 11 months ago

When attempting to import a postman collection with a name containing "/", the initial detection seems correct ("name" is correctly displayed), the import seems to be successful... "Collection imported successfully" is being displayed, but the collection is not imported at all (nothing in the destination folder, and no new collection opened in the main interface).

When looking at the dev console (postman collection called "MYAPP\SOMETHING ELSE", by example)

Uncaught (in promise) Error: Error invoking remote method 'renderer:import-collection': Error: ENOENT: no such file or directory, mkdir 'C:\Users\MY_USER\Documents\Bruno collections\MYAPP\SOMETHING ELSE'

Removing or replacing the "/" char leads to a successful import

helloanoop commented 11 months ago

@l0new4nder3r The fix done by @tpyle has been released in v0.16.3

Can you test and confirm this on your end ?

l0new4nder3r commented 11 months ago

Hi, thanks @tpyle !

Successfully tested a few minutes ago with v0.16.4

Capture d’écran 2023-09-30 à 21 43 38

Testing with a postman collection containing a slash in its name property.

Capture d’écran 2023-09-30 à 21 42 10

Importing process (same as before, slash is still present)

Capture d’écran 2023-09-30 à 21 42 40

The collection is imported without issue - the only thing is that now, its name has changed. The slash has become an hyphen. Consistent with what I see in the commit, and at least it does not break!

Improvement with a much lesser priority : allow any character in the collection name?

tpyle commented 11 months ago

Hi @l0new4nder3r,

Unfortunately, since bruno stores collections (and requests) as files and directories, that requirement comes from the filesystem, not from bruno itself. Every filesystem that I'm aware of doesn't allow / in directory names or folder names, as it's used in UNIX-like OS's as a delimiter between directories.

I suppose we could URL encode the collection name (so that in the filesystem it looks like Collection%2FName, and then render it to the user as Collection/Name), but I feel like that's somewhat odd of behavior. What are your thoughts on this @helloanoop?

helloanoop commented 11 months ago

Yes, Its a restriction at the filesystem level.

You can still choose to rename the collection in the UI and that will reflect in the UI. Meaning you can change it to Ex: "Payment/ConfigApi". This name gets updated in bruno.json which the UI will consume to render the name.

But in the filesystem level we are bounded by the naming restrictions of filesystem

bruno.json

{
  "version": "1",
  "name": "Payment/ConfigApi",
  "type": "collection"
  }
}
irfansofyana commented 11 months ago

Hey, I'm encountering similar issue here, but with different chars. I'm trying to import a postman collection with name [POC] XXX and when it's imported, I see a blank result in the IDE

tpyle commented 11 months ago

@irfansofyana can you tell me what OS you're on? Or what filesystem you're using, if you're aware? If you're on a linux/unix/mac system, you should be able to run df -T to tell.

holycacao commented 11 months ago

New user here. I name most of my requests after their route eg bruno/issues. Renaming collections works, but not requests. This is quite restrictive.

..but it looks like this is may just be a UI bug? If I manually change the name in the meta section of the request bru file, it is reflected in the UI. However, if I change it in the UI, it silently does nothing.

DaPutzy commented 11 months ago

Can confirm, there is something fishy with renaming requests via ui 🤔

irfansofyana commented 11 months ago

@irfansofyana can you tell me what OS you're on? Or what filesystem you're using, if you're aware? If you're on a linux/unix/mac system, you should be able to run df -T to tell.

Hi, I'm using macOS

ItsJustRuby commented 6 months ago

Can confirm, there is something fishy with renaming requests via ui 🤔

See also various other issues like #1336 and #1404, which are currently being solved in #349.

I am in favor of tracking the solution to the original problem (importing from Postman) in this issue.