Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Removed underscore from filename sanitation. #11

Closed
wants to merge 1 commit into from
Closed

Removed underscore from filename sanitation. #11

wants to merge 1 commit into from

Conversation

codekipple
Copy link

I wanted to be able to generate a snapshot without the preceding '_'. I tried changing the 'fileNamePrefix' option to be an empty string but a preceding underscore was still added by default.

This change stopped the default underscore. Users can still set an underscore if they like using the 'fileNamePrefix'.

What do you think?

@amercier
Copy link

That would probably require / to be generated into index.html otherwise we will end up with a file called .html, which is not ideal.

IMHO the best would be to have a sanitize option which will default to:

sanitize: function(requestUri) {
  return requestUri.replace(/\//g, '_');
}

@cburgdorf
Copy link
Owner

@amercier good catch :) I like your solution of letting the user overwrite the function that is responsible for creating the filenames. I'm happy to merge a pull request for that. However, kinda related, I would also like to have the option to write things into folder structures instead of what we currently do. We have a ticket for that, too.

@amercier
Copy link

@cburgdorf Unfortunately I'm really short on time to do that now, sorry :(

@cburgdorf
Copy link
Owner

No worries, someone will do it when the time comes :)

@cburgdorf
Copy link
Owner

You can now provide a custom function for the file name sanitization. See 06ad7be

@cburgdorf cburgdorf closed this Nov 5, 2013
@crshumate
Copy link

sanitize: function(requestUri) {
  return requestUri.replace(/\//g, '_');
}

I changed the underscore to a forward slash and it works perfectly. All snapshots are nested in subdirectories:

sanitize: function(requestUri) {
  return requestUri.replace(/\//g, '/');
}

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.

4 participants