From 23470a4a93eeaa63912357ba5eea09f504442b5b Mon Sep 17 00:00:00 2001 From: Pof Magicfingers Date: Fri, 13 Sep 2019 03:44:09 +0200 Subject: [PATCH 1/2] hotfix: fix filename variable --- dist/podcloud-feeds.js | 4 ++-- src/connectors/item.js | 2 +- src/schema/types/resolvers/enclosure.js | 2 +- test/src/schema/types/enclosure.test.js | 4 ++-- test/src/schema/types/episode.test.js | 4 ++-- test/src/schema/types/podcastItem.test.js | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/podcloud-feeds.js b/dist/podcloud-feeds.js index 5fbe4eb0..f7b3dfbb 100644 --- a/dist/podcloud-feeds.js +++ b/dist/podcloud-feeds.js @@ -1384,7 +1384,6 @@ _mongoose2.default.Promise = global.Promise; const ObjectId = _mongoose2.default.Schema.Types.ObjectId; const EnclosureUrlSchema = new _mongoose2.default.Schema({ - filename: String, path: String }); @@ -1393,6 +1392,7 @@ const EnclosureSchema = new _mongoose2.default.Schema({ length: String, mime_type: String, meta_url: EnclosureUrlSchema, + filename: String, cover_detected: _cover_schema2.default, cover_custom: _cover_schema2.default, cover_choice: String @@ -1615,7 +1615,7 @@ const Enclosure = { return enclosure.mime_type; }, url(enclosure, args, ctx) { - return "https://" + ctx.hosts.stats + "/" + enclosure.item.feed.identifier + "/" + enclosure.item._slugs[enclosure.item._slugs.length - 1] + "/enclosure." + +(enclosure.item.updated_at / 1000) + _path2.default.extname(enclosure.meta_url.filename).replace(/(.*)\?.*$/, "$1") + "?p=f"; + return "https://" + ctx.hosts.stats + "/" + enclosure.item.feed.identifier + "/" + enclosure.item._slugs[enclosure.item._slugs.length - 1] + "/enclosure." + +(enclosure.item.updated_at / 1000) + _path2.default.extname(enclosure.filename).replace(/(.*)\?.*$/, "$1") + "?p=f"; }, cover(enclosure) { let cover = null; diff --git a/src/connectors/item.js b/src/connectors/item.js index a1651154..937f01df 100644 --- a/src/connectors/item.js +++ b/src/connectors/item.js @@ -6,7 +6,6 @@ Mongoose.Promise = global.Promise const ObjectId = Mongoose.Schema.Types.ObjectId const EnclosureUrlSchema = new Mongoose.Schema({ - filename: String, path: String }) @@ -15,6 +14,7 @@ const EnclosureSchema = new Mongoose.Schema({ length: String, mime_type: String, meta_url: EnclosureUrlSchema, + filename: String, cover_detected: CoverSchema, cover_custom: CoverSchema, cover_choice: String diff --git a/src/schema/types/resolvers/enclosure.js b/src/schema/types/resolvers/enclosure.js index 72f1f31e..3e9f8b2c 100644 --- a/src/schema/types/resolvers/enclosure.js +++ b/src/schema/types/resolvers/enclosure.js @@ -20,7 +20,7 @@ const Enclosure = { enclosure.item._slugs[enclosure.item._slugs.length - 1] + "/enclosure." + +(enclosure.item.updated_at / 1000) + - path.extname(enclosure.meta_url.filename).replace(/(.*)\?.*$/, "$1") + + path.extname(enclosure.filename).replace(/(.*)\?.*$/, "$1") + "?p=f" ) }, diff --git a/test/src/schema/types/enclosure.test.js b/test/src/schema/types/enclosure.test.js index 08d3255f..198ba6b3 100644 --- a/test/src/schema/types/enclosure.test.js +++ b/test/src/schema/types/enclosure.test.js @@ -19,9 +19,9 @@ describe("Enclosure Graph Object", () => { duration_in_seconds: 600, length: "123521", mime_type: "audio/mpeg", + filename: "afile.mp3", meta_url: { - path: "http://anurl.test/afile.mp3?p=f", - filename: "afile.mp3" + path: "http://anurl.test/afile.mp3?p=f" } } diff --git a/test/src/schema/types/episode.test.js b/test/src/schema/types/episode.test.js index e09f159e..b3d24b8d 100644 --- a/test/src/schema/types/episode.test.js +++ b/test/src/schema/types/episode.test.js @@ -16,9 +16,9 @@ describe("Episode Graph Object", () => { duration_in_seconds: 600, length: "123521", mime_type: "audio/mpeg", + filename: "filename.mp3", meta_url: { - path: "http://anurl.test/afile.mp3", - filename: "filename.mp3" + path: "http://anurl.test/afile.mp3" } } } diff --git a/test/src/schema/types/podcastItem.test.js b/test/src/schema/types/podcastItem.test.js index 3e1e7333..acc4f660 100644 --- a/test/src/schema/types/podcastItem.test.js +++ b/test/src/schema/types/podcastItem.test.js @@ -97,9 +97,9 @@ describe("PodcastItem Graph Object", () => { it("should resolve an Episode when an enclosure is available", () => { const obj = { enclosure: { + filename: "arealfile.mp3", meta_url: { - path: "http://anurl.test/afile-123", - filename: "arealfile.mp3" + path: "http://anurl.test/afile-123" } } } From a8eeee3e985062950521489bc47d061db6bf55fd Mon Sep 17 00:00:00 2001 From: Pof Magicfingers Date: Fri, 13 Sep 2019 03:44:25 +0200 Subject: [PATCH 2/2] chore: bump package --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dfb637d5..6b703e3a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "podcloud-feeds", - "version": "1.2.10", + "version": "1.2.11", "description": "GraphQL API for podcloud", "scripts": { "test": "NODE_ENV=test mocha --opts test/mocha.opts",