[Pkg-javascript-commits] [node-body-parser] 03/04: add iconv patch
Andrew Kelley
andrewrk-guest at moszumanska.debian.org
Mon Jun 30 17:13:06 UTC 2014
This is an automated email from the git hooks/post-receive script.
andrewrk-guest pushed a commit to branch master
in repository node-body-parser.
commit 0ba4e53a31433d26a9593f22bda08de5284270c9
Author: Andrew Kelley <superjoe30 at gmail.com>
Date: Mon Jun 30 17:11:14 2014 +0000
add iconv patch
---
debian/patches/iconv.patch | 39 +++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 40 insertions(+)
diff --git a/debian/patches/iconv.patch b/debian/patches/iconv.patch
new file mode 100644
index 0000000..56d748c
--- /dev/null
+++ b/debian/patches/iconv.patch
@@ -0,0 +1,39 @@
+Description: use iconv instead of iconv-lite
+ Before, body-parser depended on iconv-lite which has a slightly different
+ API. Now body-parser depends on iconv.
+Author: Andrew Kelley <superjoe30 at gmail.com>
+Forwarded: not-needed
+Last-Update: 2014-06-30
+
+--- node-body-parser-1.4.3.orig/lib/read.js
++++ node-body-parser-1.4.3/lib/read.js
+@@ -8,7 +8,7 @@
+ */
+
+ var getBody = require('raw-body')
+-var iconv = require('iconv-lite')
++var Iconv = require('iconv').Iconv;
+ var typer = require('media-typer')
+ var zlib = require('zlib')
+
+@@ -91,7 +91,7 @@ function read(req, res, next, parse, opt
+ // parse
+ try {
+ body = typeof body !== 'string' && encoding !== null
+- ? iconv.decode(body, encoding)
++ ? iconvDecode(body, encoding)
+ : body
+ req.body = parse(body)
+ } catch (err){
+@@ -111,6 +111,11 @@ function read(req, res, next, parse, opt
+ }
+ }
+
++function iconvDecode(body, encoding) {
++ var iconv = new Iconv(encoding, 'utf-8');
++ return iconv.convert(body).toString('utf8');
++}
++
+ /**
+ * Get the content stream of the request.
+ *
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..f49e17e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+iconv.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-body-parser.git
More information about the Pkg-javascript-commits
mailing list