Honestpuck / scriptorium

A utility for managing the scripts in Jamf Pro
MIT License
52 stars 6 forks source link

Script with / in the name crashes the script #5

Closed damacguy closed 3 years ago

damacguy commented 3 years ago

The script saw it as a directory indicator when it wasn't so it crashed.

Silly to have it in the script name in the first place. Work around is easy enough - I renamed my script.

Honestpuck commented 3 years ago

I might try and get around it. What were you trying to do when it crashed?

damacguy commented 3 years ago

Ah, that would help. I was doing my initial download of scripts from my Jamf server. Hit this one script near the end and it said the path didn’t exist. Guessed it was a forward slash and sure enough it was. Replaced the forward slashes (there were two) with dashes and tried again and it work fine.

Honestpuck commented 3 years ago

OK, so do you think it should do a quick rename of the script or give an error message and continue? I can see benefits either way.

damacguy commented 3 years ago

The easy fix is to warn users in advance. Better might be to check in advance and either abort or skip with an alert. The best would be to escape the "/". Programmer's choice. ;-)

Honestpuck commented 3 years ago

I'm not sure '/' can be escaped. You can't do it in the shell IIRC. I think I'll skip with a note.

Honestpuck commented 3 years ago

The code now checks for '/' and prints a warning then skips the script.