Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle reserved characters in filepaths #1629

Open
wants to merge 4 commits into
base: master
from
Open
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Using safe-filename for filepath safe conversion

  • Loading branch information
Jaliborc committed May 14, 2019
commit 2f6ec452f60b365d1a03c467911212fcafd755f5
@@ -26,7 +26,7 @@ const uniq = require('uniq')
const utMetadata = require('ut_metadata')
const utPex = require('ut_pex') // browser exclude
const parseRange = require('parse-numeric-range')
const filenameReservedRegex = require('filename-reserved-regex')
const safeFilename = require('safe-filename')

const File = require('./file')
const Peer = require('./peer')
@@ -448,7 +448,7 @@ class Torrent extends EventEmitter {
}

this._rarityMap = new RarityMap(this)
this.files.each(file => file.path = file.path.replace(filenameReservedRegex(), '_'))
this.files.forEach(file => file.path = safeFilename.path(file.path))

this.store = new ImmediateChunkStore(
new this._store(this.pieceLength, {
@@ -1,7 +1,7 @@
{
"name": "webtorrent-jali",
"description": "Streaming torrent client",
"version": "0.103.1+1",
"version": "0.103.1b",
"author": {
"name": "WebTorrent, LLC",
"email": "feross@webtorrent.io",
@@ -34,7 +34,6 @@
"create-torrent": "^3.33.0",
"debug": "^4.1.0",
"end-of-stream": "^1.1.0",
"filename-reserved-regex": "^2.0.0",
"fs-chunk-store": "^1.6.2",
"immediate-chunk-store": "^2.0.0",
"load-ip-set": "^2.1.0",
@@ -53,6 +52,7 @@
"run-parallel": "^1.1.6",
"run-parallel-limit": "^1.0.3",
"safe-buffer": "^5.0.1",
"safe-filename": "^1.0.1",
"simple-concat": "^1.0.0",
"simple-get": "^3.0.1",
"simple-peer": "^9.0.0",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.