philipjscott / simple-thumbnail

A library that produces thumbnails from images, videos and URLs :mag_right:
https://www.npmjs.com/package/simple-thumbnail
MIT License
25 stars 14 forks source link

Spaces in the path end up with truncated paths. #37

Closed ajmas closed 5 years ago

ajmas commented 5 years ago

name: Bug report about: Create a report to help us improve


Describe the bug

Spaces in the path end up with truncated paths.

To Reproduce

const simple-thumbnail = require('simple-thumbnail')

const src = '/Users/myuser/Movies/My Movie With Spaces.mp4';
const src = '/Users/myuser/Movies/Thumbs/My Movie With Spaces.mp4.png';
genThumbnail(src, dest, '200x?')

Expected behavior

Spaces should be supported and thumbnails should be generated without error

Environment (please complete the following information):

Additional context Add any other context about the problem here.

philipjscott commented 5 years ago

I believe you need to escape the spaces. Try:

const simpleThumbnail = require('simple-thumbnail')

const src = '/Users/myuser/Movies/My\ Movie\ With\ Spaces.mp4'
genThumbnail(src, dest, '200x?')

I'll try testing this myself and look into adding a unit test. Thanks for bringing this up :smile:

philipjscott commented 5 years ago

Nevermind, that doesn't seem to work. I'll get right on it :+1:

philipjscott commented 5 years ago

@ajmas I made my own PR (based off yours) and merged it; hopefully your problem should be solved :smile:

I'll also be adding a "Contributing" section in the README soon.

Edit: Is it alright if I add you to the contributor list?