Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #3207, put image sizes in images table
Browse files Browse the repository at this point in the history
  • Loading branch information
ianb committed Aug 16, 2017
1 parent fdb9770 commit f762797
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions server/src/servershot.js
Expand Up @@ -760,10 +760,10 @@ ClipRewrites = class ClipRewrites {

return db.queryWithClient(
client,
`INSERT INTO images (id, shotid, clipid, url, contenttype)
VALUES ($1, $2, $3, $4, $5)
`INSERT INTO images (id, shotid, clipid, url, contenttype, size)
VALUES ($1, $2, $3, $4, $5, $6)
`,
[data.uuid, this.shot.id, clipId, data.url, data.binary.contentType]);
[data.uuid, this.shot.id, clipId, data.url, data.binary.contentType, data.binary.data.length]);
})
);
}).then(() => {
Expand All @@ -775,14 +775,14 @@ ClipRewrites = class ClipRewrites {

return db.queryWithClient(
client,
`INSERT INTO images (id, shotid, clipid, url, contenttype)
VALUES ($1, $2, $3, $4, $5)
`INSERT INTO images (id, shotid, clipid, url, contenttype, size)
VALUES ($1, $2, $3, $4, $5, $6)
`,
// Since we don't have a clipid for the thumbnail and the column is NOT NULL,
// Use the thumbnail uuid as the clipid. This allows figuring out which
// images are thumbnails, too.
[this.toInsertThumbnail.uuid, this.shot.id, this.toInsertThumbnail.uuid,
this.toInsertThumbnail.url, this.toInsertThumbnail.contentType]);
this.toInsertThumbnail.url, this.toInsertThumbnail.contentType, this.toInsertThumbnail.binary.data.length]);
}).then(() => {
this.committed = true;
});
Expand Down
1 change: 0 additions & 1 deletion test/server/test_shot_put_auth.py
Expand Up @@ -39,7 +39,6 @@ def test_update():
shot_page = user.read_shot(shot_url)
assert "A_TEST_SITE_1" in shot_page["page"]
shot_id = urlparse.urlsplit(shot_url).path.strip("/")
requests.get("http://localhost:10080/second-request-happening")
user.create_shot(shot_id=shot_id, docTitle="A_TEST_SITE_2", image_index=1)
later_shot_page = user.read_shot(shot_url)
assert "A_TEST_SITE_2" in later_shot_page["page"]
Expand Down

0 comments on commit f762797

Please sign in to comment.