Sketchup(Free) SaveAs messing up filenames with dots

bug

#1

I played a bit with Sketchup(Free) and tried saving files to TrimbleConnect when i stumbled over this.
It seems Sketchup(Free) is messing up filenames with dots when using “Save As”.

Bug or Feature?

To reproduce try the following:

Choose “Save As” from the top folder menu and type “test_v1.0” into the bottom “Name:” input-field.
The file ends up as “test_v1” in the top menu bar next to the hamburger (“test_v1.skp” in TrimbleConnect file browser).
Obviously Sketchup(Free) interprets the trailing “.0” as file extension and replaces “.0” by “.skp” instead of simply appending “.skp”.

Ok (i thought) - let’s try “test_v1.0.skp” in the input field then … => again “test_v1.skp” (???).
The “.skp” seems to be ignored or removed, the then trailing “.0” again replaced by “.skp”. I don’t get the logic here.

To correctly get the file saved as “test_v1.0.skp”, you’d need to type “test_v1.0…skp” (EDIT: actually 2 dots leading skp - Website displays three dots although i typed only 2) into the Name field.

I’d say this is a bug, since it’s highly unexpected.
Most other apps i know would simply append the file extension (".skp" in this case) if the typed-in filename doesn’t already end with “.skp”. At least the typed-in filename should be left unaltered if the correct file-extension is already appended (given it contains no illegal characters).

Also, the current behaviour can lead to accidental file overwriting:

  • “Save As” a file named “test_v1.0” ends up as “test_v1.skp” on the server.
  • now altering the contents and trying to save as version 1.1:
  • “Save As” the file named “test_v1.1” ends up as “test_v1.skp” again - overwriting the previous file v1.0. (Not sure now if i even got a file overwrite warning here)

Apart from the “Save As” filename mangling, Sketchup(Free) seems to be capable of handling file(names) containing dots quite fine - at least from what i’ve tried.

Best regards,
Michael S.


#2

This is a bug. I’ve seen the exact same behavior in other programs. I think the Kerkythea exporter for SketchUp is/was one of them. I’ve also made my own implementations that doesn’t suffer from this bug.

The programmer wants to ensure all file names ends with .skp, regardless of whether the user has written it or not. A very simple implementation is to replace everything after the last dot with skp (some programs even catches the first for). A proper implementation, that works in all cases, is to check if the string ends with .skp and otherwise append it.


#3

Hi @m.schardt, yes this is a bug. Thanks for reporting and the nice analysis. We will fix this ASAP but as a workaround, you can rename the model by clicking on the model title (at the upper left corner). We handle the dots correctly in that case.

@eneroth3: Thanks - there are very good ways to deal with this issue as you suggested. We have an old piece of code that escaped rigorous testing in this case. :disappointed:


#4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.