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.
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!
All content Copyright (c) by Cyotek Ltd or its respective writers. Permission to reproduce news and web log entries and other RSS feed content in unmodified form without notice is granted provided they are not used to endorse or promote any products or opinions (other than what was expressed by the author) and without taking them out of context. Written permission from the copyright owner must be obtained for everything else.
Original URL of this content is https://www.cyotek.com/blog/products/webcopy-1-7-local-file-name-generation?source=rss.