Skip to content

Commit

Permalink
attempt at escaping url from paths correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Jun 25, 2013
1 parent eb0b79a commit 83a50b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/lib/models/document.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,13 @@ class DocumentModel extends FileModel
# Figure out the rendered url
if outFilename
if relativeDirPath
relativeOutPath = "#{relativeDirPath}/#{outFilename}"
relativeOutPath = pathUtil.join(relativeDirPath, outFilename)
else
relativeOutPath = "#{outFilename}"
changes.relativeOutPath = relativeOutPath
unless url
changes.url = url = "/#{relativeOutPath}"
escapedRelativeOutPath = relativeOutPath.replace(/[\\]/g, '/')
changes.url = url = "/#{escapedRelativeOutPath}"

# Set name if it doesn't exist already
if !name and outFilename?
Expand Down
3 changes: 2 additions & 1 deletion src/lib/models/file.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ class FileModel extends Model

# Create the URL for the file
if !url and relativePath
url = "/#{relativePath}"
escapedRelativePath = relativePath.replace(/[\\]/g, '/')
url = "/#{escapedRelativePath}"
@setUrl(url)

# Create a slug for the file
Expand Down

0 comments on commit 83a50b9

Please sign in to comment.