-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows / Invalid filename #146
Comments
Fixing this should simply be a matter of sanitizing the name before making a URL out of it. |
@cvasilak, can you provide some way of replicating this outcome? |
I believe the proper fix here is to be URL escaping the declaration name. |
@jpsim are you thinking something as simple as adding the following to sourcekitten.rb ...
require 'uri'
...
[URI.escape(doc.name) + '.html']
...
makes for somewhat "ugly" file names e.g. "Global%20Variables.html" |
it does make for fairly uglier URLs, but I believe that's the safest way to generate URLs. |
I'll have a go at it if I'm not overwhelmed by todays event 😸 |
Hmm simply using If we use Any comment on this @jpsim ? |
I get the feeling that this has already been solved by other ruby projects in a general way, and that |
True, so a gem like https://github.com/agilecreativity/filename_cleaner
Would result in And the file: |
I'm curious, what do you mean by this? Does it cause issues with Safari and Chrome? This seems like a simpler & better supported solution rather than |
@jpsim I might have misunderstood the issue but if Should |
What happens if you try that? |
Then everything is fine, file is named But the file name of the OP will remain and cause trouble? I don't even know how the filename mentioned by OP would come into question. |
The issue wasn't in saving the file, but rather accessing it unescaped via a URL in a browser.
A file name like |
But head :001 > require 'uri'
=> true
head :002 > URI.escape("init(baseURL:sessionConfig:requestSerializer:responseSerializer:).html")
=> "init(baseURL:sessionConfig:requestSerializer:responseSerializer:).html"
head :003 > |
Ah you're right. Reading the original issue description again, the issue was that the filename is invalid on Windows because it contains colons. I'm not sure how much of a problem this actually is in practice then, because jazzy only runs on OS X and who in the world would run a webserver for Swift documentation on IIS. I'm inclined to just close this as "won't fix". Am I crazy for thinking this @mbogh @segiddins ? |
We could apply |
But then this would uglify URLs for everyone, with the only benefit being allowing these docs to be hosted on Windows? |
True, it would seem that all modern browser does not break if whitespace e.g. is not escaped. Should I simply delete my branches(prs)? |
I think so. I really appreciate you digging into this though, but it feels better to leave this one as-is IMO. Closing. |
The configuration option
Any other flags you normally use (such as |
Hi all,
noticed an issue when generating 'jazzy' documentation. In particular, if the html filename generated contains a ":" character such as
fails on windows (eg. checking out a project the contains this file). Is there any way this separator character can be customised in the command line to make windows happy so checking out a project won't fail?
Thank you!
The text was updated successfully, but these errors were encountered: