Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Handle project descriptions ending in "." #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DrivebyCoding
Copy link

Projects with description ending in "." results in filenames ending in "." which is not legal on Windows

Projects with description ending in "." results in filenames ending in "." which is not legal on Windows
@DrivebyCoding
Copy link
Author

Had the exporter trying to write file "... rsion..f3d\Bedroom lamp fix. Used version.". This patch strips all trailing "."s.

@Jnesselr
Copy link
Owner

Okay, SO! This is gonna get a little weird to handle some of these file issues. It's very possible to have a name like Test*.

The regex replacement makes it look like Test ., and you stripping off the period at the end turns it into Test which is invalid because it has a space at the end. Similarly, Test.stp. would turn into Test.stp and the code above it that handles components with filename extensions would fail. Granted, that one is less of a common case probably but... Not gonna lie, getting pretty paranoid about the number of ways a file name can be invalid. If only Autodesk made a way we could unit test this crap. (I could probably figure it out, but do I hate myself that much, no, no I don't)

Luckily, we replace anything that's not a-z, A-Z, 0-9, spaces, newlines (wait should that one be there), and periods with a space. Which means we can follow that up with a cute lil regex that just replaces any spaces/periods/newlines at the beginning and end and replaces it with a space and then call a single strip at the end of all that.

Does that make sense at all? I'm definitely typing this idea out by the seat of my pants so....

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants