This content has moved - please find it at https://devblog.cyotek.com.

Although these pages remain accessible, some content may not display correctly in future as the new blog evolves.

Visit https://devblog.cyotek.com.

WebCopy 1.7 - local file name generation

As part of WebCopy 1.7's mission to reduce user confusion and make the product more appealing, a pair of new options for controlling local file name generation have been introduced, as well as correcting a potentially confusing bug.

A screenshot of the adjusted Local Files configuration settings

Preserving the original extension

By default, WebCopy will name local files to match their content type. For example, if you download the homepage of a website which is named index.php, WebCopy will save a local file named index.html - end users would probably very confused trying to open a .php file and either the operating system doesn't know how to handle it, or it executes the PHP runtime.

While this approach works, it does mean the original extension is lost. For 1.7, we've introduced a new Keep original extension option, located in the Local Files category. When set, if WebCopy needs to change the extension, it includes the original extension as well. Our hypothetical index.php file would be called index.php.html when saved locally.

This option is currently enabled for all new projects, although we are currently evaluating this. As with most new options, it is not set for existing projects and must be explicitly enabled.

We've also fixed a bug where WebCopy would change extensions when it shouldn't. For example, downloading jpg images would cause the local files to have a jpeg extension. WebCopy now only changes extensions if they don't match any registered extension for the appropriate content type.

Using query strings to construct the local file name

The query string demonstration page includes links to a page with two different query string

  • https://demo.cyotek.com/features/querystringstest.php?section=alpha
  • https://demo.cyotek.com/features/querystringstest.php?section=beta

Current versions of WebCopy only consider the page name for local file generation, therefore when copying the demonstration website the above examples are copied locally as

  • querystringstest.html
  • querystringstest-1.html

This can make very difficult to identify which page the offline file originally belonged to.

WebCopy 1.7 introduces another new option, Use query string in local file names, also found in the Local Files category. When enabled, WebCopy will consider the query string of the URL as well as the page name. With the option set, the pages above would now be saved as

  • querystringstest-section-alpha.html
  • querystringstest-section-beta.html

Each key pair in the query string will be present in the filename, separated by dashes. This option is currently not enabled by default for new projects.

Are these options helpful?

As always we hope these new options will be useful to end users. Would they be helpful for you? Do you think we should offer other options? Please let us know!

Update History

  • 2018-11-17 - First published
  • 2020-11-23 - Updated formatting

About The Author

Gravatar

The founder of Cyotek, Richard enjoys creating new blog content for the site. Much more though, he likes to develop programs, and can often found writing reams of code. A long term gamer, he has aspirations in one day creating an epic video game. Until that time, he is mostly content with adding new bugs to WebCopy and the other Cyotek products.

Leave a Comment

While we appreciate comments from our users, please follow our posting guidelines. Have you tried the Cyotek Forums for support from Cyotek and the community?

Styling with Markdown is supported