From b12582b0f3b9c8eb14f79ce80e3aed5ab4768c91 Mon Sep 17 00:00:00 2001 From: Moritz Brunner Date: Tue, 7 Nov 2017 21:44:23 +0100 Subject: [PATCH] Fix #3530, support domains up to 253 characters long --- server/db-patches/patch-21-22.sql | 2 ++ server/schema.sql | 4 ++-- server/src/dbschema.js | 2 +- server/src/server.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 server/db-patches/patch-21-22.sql diff --git a/server/db-patches/patch-21-22.sql b/server/db-patches/patch-21-22.sql new file mode 100644 index 0000000000..23eb5bbe11 --- /dev/null +++ b/server/db-patches/patch-21-22.sql @@ -0,0 +1,2 @@ +ALTER TABLE data ALTER COLUMN id TYPE character varying(270); +ALTER TABLE images ALTER COLUMN shotid TYPE character varying(270); diff --git a/server/schema.sql b/server/schema.sql index d6b2e9e0c4..b314daf0e4 100644 --- a/server/schema.sql +++ b/server/schema.sql @@ -11,7 +11,7 @@ CREATE TABLE accounts ( email text ); CREATE TABLE data ( - id character varying(120) NOT NULL, + id character varying(270) NOT NULL, deviceid character varying(200), created timestamp without time zone DEFAULT now(), value text NOT NULL, @@ -35,7 +35,7 @@ CREATE TABLE devices ( ); CREATE TABLE images ( id character varying(200) NOT NULL, - shotid character varying(200) NOT NULL, + shotid character varying(270) NOT NULL, clipid character varying(200) NOT NULL, contenttype text NOT NULL, url text, diff --git a/server/src/dbschema.js b/server/src/dbschema.js index a6fe24a7ca..9982f04672 100644 --- a/server/src/dbschema.js +++ b/server/src/dbschema.js @@ -6,7 +6,7 @@ const mozlog = require("./logging").mozlog("dbschema"); // When updating the database, please also run ./bin/dumpschema --record // This updates schema.sql with the latest full database schema -const MAX_DB_LEVEL = exports.MAX_DB_LEVEL = 21; +const MAX_DB_LEVEL = exports.MAX_DB_LEVEL = 22; exports.forceDbVersion = function(version) { mozlog.info("forcing-db-version", {db: db.constr, version}); diff --git a/server/src/server.js b/server/src/server.js index cb0a72c255..b7e51c0133 100644 --- a/server/src/server.js +++ b/server/src/server.js @@ -290,7 +290,7 @@ app.param("id", function(req, res, next, id) { }); app.param("domain", function(req, res, next, domain) { - if (/^[^\s/]{1,100}$/.test(domain)) { + if (/^[^\s/]{1,252}$/.test(domain)) { next(); return; }