From 701e5b9a19db34834108fdc5fe48923784385ed2 Mon Sep 17 00:00:00 2001 From: ThibG Date: Tue, 7 Jul 2020 16:32:14 +0200 Subject: [PATCH 1/7] Fix ogg vorbis files with a cover art not being correctly processed (#14255) --- .../media_type_spoof_detector_extensions.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/paperclip/media_type_spoof_detector_extensions.rb b/lib/paperclip/media_type_spoof_detector_extensions.rb index 9c05573564..363934d8d1 100644 --- a/lib/paperclip/media_type_spoof_detector_extensions.rb +++ b/lib/paperclip/media_type_spoof_detector_extensions.rb @@ -2,8 +2,16 @@ module Paperclip module MediaTypeSpoofDetectorExtensions - def calculated_content_type - @calculated_content_type ||= type_from_mime_magic || type_from_file_command + def mapping_override_mismatch? + !Array(mapped_content_type).include?(calculated_content_type) && !Array(mapped_content_type).include?(type_from_mime_magic) + end + + def calculated_media_type_from_mime_magic + @calculated_media_type_from_mime_magic ||= type_from_mime_magic.split('/').first + end + + def calculated_type_mismatch? + !media_types_from_name.include?(calculated_media_type) && !media_types_from_name.include?(calculated_media_type_from_mime_magic) end def type_from_mime_magic From 961789d511ad8742b8bc75d145b3a83ec5d03ad8 Mon Sep 17 00:00:00 2001 From: Alex Dunn Date: Tue, 7 Jul 2020 11:35:55 -0700 Subject: [PATCH 2/7] helm: bump chart and default image version to 3.1.5 (#14256) --- chart/Chart.yaml | 2 +- chart/values.yaml.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chart/Chart.yaml b/chart/Chart.yaml index f028227e35..783569451d 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -20,7 +20,7 @@ version: 0.1.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. -appVersion: 3.1.4 +appVersion: 3.1.5 dependencies: - name: elasticsearch diff --git a/chart/values.yaml.template b/chart/values.yaml.template index 0710722a67..4a8286d001 100644 --- a/chart/values.yaml.template +++ b/chart/values.yaml.template @@ -4,7 +4,7 @@ image: repository: tootsuite/mastodon pullPolicy: Always # https://hub.docker.com/r/tootsuite/mastodon/tags - tag: v3.1.4 + tag: v3.1.5 # alternatively, use `latest` for the latest release or `edge` for the image # built from the most recent commit # From 258171549120142a6a7dac40f17ecc2087433f4a Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 8 Jul 2020 09:22:23 +0200 Subject: [PATCH 3/7] Fix WebUI crash on sensitive preview card with no preview thumbnail (#14260) Fixes #14257 --- app/javascript/mastodon/features/status/components/card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/mastodon/features/status/components/card.js index 0af7c54e4b..0a84e481a7 100644 --- a/app/javascript/mastodon/features/status/components/card.js +++ b/app/javascript/mastodon/features/status/components/card.js @@ -106,7 +106,7 @@ export default class Card extends React.PureComponent { componentDidUpdate (prevProps) { const { card } = this.props; - if (card.get('blurhash') && (!prevProps.card || prevProps.card.get('blurhash') !== card.get('blurhash'))) { + if (card.get('blurhash') && (!prevProps.card || prevProps.card.get('blurhash') !== card.get('blurhash')) && this.canvas) { this._decode(); } } From 606c975050e8d656ceb7130797d8adbcd12f0e49 Mon Sep 17 00:00:00 2001 From: Takeshi Umeda Date: Wed, 8 Jul 2020 16:23:23 +0900 Subject: [PATCH 4/7] Fix RemoveDuplicatedIndexesPghero to check for the existence of the index (#14259) --- ...181721_remove_duplicated_indexes_pghero.rb | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb b/db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb index e2eaf46f16..1d6ba1fe98 100644 --- a/db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb +++ b/db/migrate/20200510181721_remove_duplicated_indexes_pghero.rb @@ -1,12 +1,22 @@ class RemoveDuplicatedIndexesPghero < ActiveRecord::Migration[5.2] - def change - remove_index :account_conversations, name: "index_account_conversations_on_account_id", column: :account_id - remove_index :account_identity_proofs, name: "index_account_identity_proofs_on_account_id", column: :account_id - remove_index :account_pins, name: "index_account_pins_on_account_id", column: :account_id - remove_index :announcement_mutes, name: "index_announcement_mutes_on_account_id", column: :account_id - remove_index :announcement_reactions, name: "index_announcement_reactions_on_account_id", column: :account_id - remove_index :bookmarks, name: "index_bookmarks_on_account_id", column: :account_id - remove_index :markers, name: "index_markers_on_user_id", column: :user_id + def up + remove_index :account_conversations, name: :index_account_conversations_on_account_id if index_exists?(:account_conversations, :account_id, name: :index_account_conversations_on_account_id) + remove_index :account_identity_proofs, name: :index_account_identity_proofs_on_account_id if index_exists?(:account_identity_proofs, :account_id, name: :index_account_identity_proofs_on_account_id) + remove_index :account_pins, name: :index_account_pins_on_account_id if index_exists?(:account_pins, :account_id, name: :index_account_pins_on_account_id) + remove_index :announcement_mutes, name: :index_announcement_mutes_on_account_id if index_exists?(:announcement_mutes, :account_id, name: :index_announcement_mutes_on_account_id) + remove_index :announcement_reactions, name: :index_announcement_reactions_on_account_id if index_exists?(:announcement_reactions, :account_id, name: :index_announcement_reactions_on_account_id) + remove_index :bookmarks, name: :index_bookmarks_on_account_id if index_exists?(:bookmarks, :account_id, name: :index_bookmarks_on_account_id) + remove_index :markers, name: :index_markers_on_user_id if index_exists?(:markers, :user_id, name: :index_markers_on_user_id) + end + + def down + add_index :account_conversations, :account_id, name: :index_account_conversations_on_account_id unless index_exists?(:account_conversations, :account_id, name: :index_account_conversations_on_account_id) + add_index :account_identity_proofs, :account_id, name: :index_account_identity_proofs_on_account_id unless index_exists?(:account_identity_proofs, :account_id, name: :index_account_identity_proofs_on_account_id) + add_index :account_pins, :account_id, name: :index_account_pins_on_account_id unless index_exists?(:account_pins, :account_id, name: :index_account_pins_on_account_id) + add_index :announcement_mutes, :account_id, name: :index_announcement_mutes_on_account_id unless index_exists?(:announcement_mutes, :account_id, name: :index_announcement_mutes_on_account_id) + add_index :announcement_reactions, :account_id, name: :index_announcement_reactions_on_account_id unless index_exists?(:announcement_reactions, :account_id, name: :index_announcement_reactions_on_account_id) + add_index :bookmarks, :account_id, name: :index_bookmarks_on_account_id unless index_exists?(:bookmarks, :account_id, name: :index_bookmarks_on_account_id) + add_index :markers, :user_id, name: :index_markers_on_user_id unless index_exists?(:markers, :user_id, name: :index_markers_on_user_id) end end From d308a863fbd373b94fa571103ad431782c29e074 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 8 Jul 2020 12:58:17 +0200 Subject: [PATCH 5/7] Fix WebUI crash on sensitive preview card with no preview thumbnail (#14261) Follow-up on #14260 which only fixed half the call sites --- app/javascript/mastodon/features/status/components/card.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/mastodon/features/status/components/card.js index 0a84e481a7..971682df8b 100644 --- a/app/javascript/mastodon/features/status/components/card.js +++ b/app/javascript/mastodon/features/status/components/card.js @@ -94,7 +94,7 @@ export default class Card extends React.PureComponent { componentDidMount () { window.addEventListener('resize', this.handleResize, { passive: true }); - if (this.props.card && this.props.card.get('blurhash')) { + if (this.props.card && this.props.card.get('blurhash') && this.canvas) { this._decode(); } } From 65e5efbdf4bc3c70dbf772e84d02255d497cc7b9 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 8 Jul 2020 13:57:06 +0200 Subject: [PATCH 6/7] Revert tesseract.js to tesseract.js@2.0.0-alpha.16 (#14262) The OCR feature in master is broken, there are several reasons for this: - https://github.com/naptha/tesseract.js/issues/369 - https://github.com/naptha/tesseract.js/issues/346 - and the fact that the worker JS file is served with an unversioned URL, and, in the nginx config we provide, served with "public, max-age=31536000, immutable", leading to version mismatches as the old version gets cached --- package.json | 2 +- yarn.lock | 79 +++++++++++++++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index fc151a5fcb..178c18d0ed 100644 --- a/package.json +++ b/package.json @@ -157,7 +157,7 @@ "stringz": "^2.1.0", "substring-trie": "^1.0.2", "terser-webpack-plugin": "^3.0.6", - "tesseract.js": "^2.1.1", + "tesseract.js": "2.0.0-alpha.16", "throng": "^4.0.0", "tiny-queue": "^0.2.1", "uuid": "^8.2.0", diff --git a/yarn.lock b/yarn.lock index 491a8b298a..5b71b6b79b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2219,6 +2219,14 @@ axe-core@^3.5.4: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-3.5.5.tgz#84315073b53fa3c0c51676c588d59da09a192227" integrity sha512-5P0QZ6J5xGikH780pghEdbEKijCTrruK9KxtPZCFWUpef0f6GipO+xEZ5GKCb020mmqgbiNO6TcA55CriL784Q== +axios@^0.18.0: + version "0.18.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.1.tgz#ff3f0de2e7b5d180e757ad98000f1081b87bcea3" + integrity sha512-0BfJq4NSfQXd+SkFdrvFbG7addhYSBA2mQwISr46pD6E5iqkWg02RAs8vyTT/j0RTnoYmeXauBuSv1qKwR179g== + dependencies: + follow-redirects "1.5.10" + is-buffer "^2.0.2" + axios@^0.19.2: version "0.19.2" resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" @@ -2875,6 +2883,11 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== +check-types@^7.4.0: + version "7.4.0" + resolved "https://registry.yarnpkg.com/check-types/-/check-types-7.4.0.tgz#0378ec1b9616ec71f774931a3c6516fad8c152f4" + integrity sha512-YbulWHdfP99UfZ73NcUDlNJhEIDgm9Doq9GhpyXbF+7Aegi3CVV7qqMCKTTqJxlvEvnQBp9IA+dxsGN6xK/nSg== + check-types@^8.0.3: version "8.0.3" resolved "https://registry.yarnpkg.com/check-types/-/check-types-8.0.3.tgz#3356cca19c889544f2d7a95ed49ce508a0ecf552" @@ -4740,10 +4753,10 @@ file-loader@^6.0.0: loader-utils "^2.0.0" schema-utils "^2.6.5" -file-type@^12.4.1: - version "12.4.2" - resolved "https://registry.yarnpkg.com/file-type/-/file-type-12.4.2.tgz#a344ea5664a1d01447ee7fb1b635f72feb6169d9" - integrity sha512-UssQP5ZgIOKelfsaB5CuGAL+Y+q7EmONuiwF3N5HAH0t27rvrttgi6Ra9k/+DVaY9UF6+ybxu5pOXLUdA8N7Vg== +file-type@^10.5.0: + version "10.11.0" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-10.11.0.tgz#2961d09e4675b9fb9a3ee6b69e9cd23f43fd1890" + integrity sha512-uzk64HRpUZyTGZtVuvrjP0FYxzQrBf4rojot6J65YMEbwBLB0CWm0CLojVpwpmFmxcE/lkvYICgfcGozbBq6rw== file-uri-to-path@1.0.0: version "1.0.0" @@ -5528,7 +5541,7 @@ icss-utils@^4.0.0, icss-utils@^4.1.1: dependencies: postcss "^7.0.14" -idb-keyval@^3.2.0: +idb-keyval@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/idb-keyval/-/idb-keyval-3.2.0.tgz#cbbf354deb5684b6cdc84376294fc05932845bd6" integrity sha512-slx8Q6oywCCSfKgPgL0sEsXtPVnSbTLWpyiDcu6msHOyKOLari1TD1qocXVCft80umnkk3/Qqh3lwoFt8T/BPQ== @@ -5846,6 +5859,11 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" +is-buffer@^2.0.2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.4.tgz#3e572f23c8411a5cfd9557c849e3665e0b290623" + integrity sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A== + is-callable@^1.1.4, is-callable@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.0.tgz#83336560b54a38e35e3a2df7afd0454d691468bb" @@ -5917,11 +5935,6 @@ is-docker@^2.0.0: resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.0.0.tgz#2cb0df0e75e2d064fe1864c37cdeacb7b2dcf25b" integrity sha512-pJEdRugimx4fBMra5z2/5iRdZ63OhYV0vr0Dwm5+xtW4D1FvRkB8hamMIhnWfyJeDdyr/aa7BDyNbtG38VxgoQ== -is-electron@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-electron/-/is-electron-2.2.0.tgz#8943084f09e8b731b3a7a0298a7b5d56f6b7eef0" - integrity sha512-SpMppC2XR3YdxSzczXReBjqs2zGscWQpBIKqwXYBFic0ERaxNVgwLCHwOLZeESfdJQjX0RDvrJ1lBXX2ij+G1Q== - is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -6107,6 +6120,11 @@ is-typedarray@^1.0.0, is-typedarray@~1.0.0: resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= +is-url@1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/is-url/-/is-url-1.2.2.tgz#498905a593bf47cc2d9e7f738372bbf7696c7f26" + integrity sha1-SYkFpZO/R8wtnn9zg3K792lsfyY= + is-url@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/is-url/-/is-url-1.2.4.tgz#04a4df46d28c4cff3d73d01ff06abeb318a1aa52" @@ -7367,11 +7385,6 @@ nice-try@^1.0.4: resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== -node-fetch@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== - node-forge@0.9.0: version "0.9.0" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" @@ -9193,7 +9206,7 @@ regenerator-runtime@^0.12.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg== -regenerator-runtime@^0.13.3, regenerator-runtime@^0.13.4: +regenerator-runtime@^0.13.4: version "0.13.5" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697" integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA== @@ -10517,28 +10530,36 @@ terser@^4.1.2, terser@^4.8.0: source-map "~0.6.1" source-map-support "~0.5.12" -tesseract.js-core@^2.2.0: +tesseract.js-core@^2.0.0-beta.12: version "2.2.0" resolved "https://registry.yarnpkg.com/tesseract.js-core/-/tesseract.js-core-2.2.0.tgz#6ef78051272a381969fac3e45a226e85022cffef" integrity sha512-a8L+OJTbUipBsEDsJhDPlnLB0TY1MkTZqw5dqUwmiDSjUzwvU7HWLg/2+WDRulKUi4LE+7PnHlaBlW0k+V0U0w== -tesseract.js@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/tesseract.js/-/tesseract.js-2.1.1.tgz#5c50fc95542ce8d834cb952bfb75a8fc85f1441d" - integrity sha512-utg0A8UzT1KwBvZf+UMGmM8LU6izeol6yIem0Z44+7Qqd/YWgRVQ99XOG18ApTOXX48lGE++PDwlcZYkv0ygRQ== +tesseract.js-utils@^1.0.0-beta.8: + version "1.0.0-beta.8" + resolved "https://registry.yarnpkg.com/tesseract.js-utils/-/tesseract.js-utils-1.0.0-beta.8.tgz#d1ef25c12609a337c3e0ac12a33f9903f3145a68" + integrity sha512-qjHBfWfzo2o1ZY9XI0Wh2hmpp38+mIgCMOk60W5Yyie/pBl421VLBKOZUEwQgpbLnOJ24VU6Q8yXsVgtFFHcFg== dependencies: + axios "^0.18.0" bmp-js "^0.1.0" - file-type "^12.4.1" - idb-keyval "^3.2.0" - is-electron "^2.2.0" + file-type "^10.5.0" + idb-keyval "^3.1.0" is-url "^1.2.4" - node-fetch "^2.6.0" - opencollective-postinstall "^2.0.2" - regenerator-runtime "^0.13.3" - resolve-url "^0.2.1" - tesseract.js-core "^2.2.0" zlibjs "^0.3.1" +tesseract.js@2.0.0-alpha.16: + version "2.0.0-alpha.16" + resolved "https://registry.yarnpkg.com/tesseract.js/-/tesseract.js-2.0.0-alpha.16.tgz#1e17717234a1464481abe12283f2c3ac79603d2e" + integrity sha512-8g3je2Kl8rkAFtpmwilGGj+8rCiPClNQaCjW6IafOPNn7hzFnVdL6fU6rG1Xsrc4Twv0HOa75kbpx5u70/WbTA== + dependencies: + axios "^0.18.0" + check-types "^7.4.0" + is-url "1.2.2" + opencollective-postinstall "^2.0.2" + resolve-url "^0.2.1" + tesseract.js-core "^2.0.0-beta.12" + tesseract.js-utils "^1.0.0-beta.8" + test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" From 0d2135a46172fd6931f757ef083ad99f4522081d Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 8 Jul 2020 14:54:47 +0200 Subject: [PATCH 7/7] Fix new accent color not refreshing when changing thumbnail for audio uploads (#14264) --- app/javascript/mastodon/features/audio/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/audio/index.js b/app/javascript/mastodon/features/audio/index.js index 686709ac38..f0cd79873f 100644 --- a/app/javascript/mastodon/features/audio/index.js +++ b/app/javascript/mastodon/features/audio/index.js @@ -103,7 +103,7 @@ class Audio extends React.PureComponent { } componentDidUpdate (prevProps, prevState) { - if (prevProps.src !== this.props.src || this.state.width !== prevState.width || this.state.height !== prevState.height) { + if (prevProps.src !== this.props.src || this.state.width !== prevState.width || this.state.height !== prevState.height || prevProps.accentColor !== this.props.accentColor) { this._clear(); this._draw(); }