mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
Merge pull request #2486 from jaswilli/issue-2485
Replace spaces in uploaded filenames with hyphens
This commit is contained in:
commit
eeb6297afe
2 changed files with 2 additions and 2 deletions
|
@ -41,7 +41,7 @@ baseStore = {
|
||||||
'getUniqueFileName': function (store, image, targetDir) {
|
'getUniqueFileName': function (store, image, targetDir) {
|
||||||
var done = when.defer(),
|
var done = when.defer(),
|
||||||
ext = path.extname(image.name),
|
ext = path.extname(image.name),
|
||||||
name = path.basename(image.name, ext).replace(/[\W]/gi, '_');
|
name = path.basename(image.name, ext).replace(/[\W]/gi, '-');
|
||||||
|
|
||||||
this.generateUnique(store, targetDir, name, ext, 0, done);
|
this.generateUnique(store, targetDir, name, ext, 0, done);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ describe('Local File System Storage', function () {
|
||||||
it('should send correct path to image when original file has spaces', function (done) {
|
it('should send correct path to image when original file has spaces', function (done) {
|
||||||
image.name = 'AN IMAGE.jpg';
|
image.name = 'AN IMAGE.jpg';
|
||||||
localfilesystem.save(image).then(function (url) {
|
localfilesystem.save(image).then(function (url) {
|
||||||
url.should.equal('/content/images/2013/Sep/AN_IMAGE.jpg');
|
url.should.equal('/content/images/2013/Sep/AN-IMAGE.jpg');
|
||||||
return done();
|
return done();
|
||||||
}).then(null, done);
|
}).then(null, done);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue