diff --git a/.babelrc b/.babelrc index 1eb1208aa6..9151969bde 100644 --- a/.babelrc +++ b/.babelrc @@ -6,7 +6,7 @@ "presets": [ ["@babel/preset-env", { "targets": { - "node": "8" + "node": "12" } }] ], diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef0da0040e..70abb020ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: - '**' env: COVERAGE_OPTION: ./node_modules/.bin/nyc - NODE_VERSION: 10 + NODE_VERSION: 14.16.0 PARSE_SERVER_TEST_TIMEOUT: 20000 jobs: check-ci: @@ -82,21 +82,16 @@ jobs: MONGODB_TOPOLOGY: standalone MONGODB_STORAGE_ENGINE: wiredTiger NODE_VERSION: 14.16.0 - - name: Node 10 - MONGODB_VERSION: 4.4.4 - MONGODB_TOPOLOGY: standalone - MONGODB_STORAGE_ENGINE: wiredTiger - NODE_VERSION: 10.24.0 - name: Node 12 MONGODB_VERSION: 4.4.4 MONGODB_TOPOLOGY: standalone MONGODB_STORAGE_ENGINE: wiredTiger - NODE_VERSION: 12.21.0 + NODE_VERSION: 12.22.0 - name: Node 15 MONGODB_VERSION: 4.4.4 MONGODB_TOPOLOGY: standalone MONGODB_STORAGE_ENGINE: wiredTiger - NODE_VERSION: 15.12.0 + NODE_VERSION: 15.13.0 fail-fast: false name: ${{ matrix.name }} timeout-minutes: 15 diff --git a/CHANGELOG.md b/CHANGELOG.md index a8b6accab4..fe4720b1e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,7 @@ ___ - Added Parse Server Security Check to report weak security settings (Manuel Trezza, dblythy) [#7247](https://github.com/parse-community/parse-server/issues/7247) - EXPERIMENTAL: Added new page router with placeholder rendering and localization of custom and feature pages such as password reset and email verification (Manuel Trezza) [#6891](https://github.com/parse-community/parse-server/issues/6891) - EXPERIMENTAL: Added custom routes to easily customize flows for password reset, email verification or build entirely new flows (Manuel Trezza) [#7231](https://github.com/parse-community/parse-server/issues/7231) +- Remove support for Node 10 which has reached its End-of-Life support date (Manuel Trezza) [#7314](https://github.com/parse-community/parse-server/pull/7314) ### Other Changes - Fix error when a not yet inserted job is updated (Antonio Davi Macedo Coelho de Castro) [#7196](https://github.com/parse-community/parse-server/pull/7196) - request.context for afterFind triggers (dblythy) [#7078](https://github.com/parse-community/parse-server/pull/7078) @@ -120,6 +121,8 @@ ___ - Improve data consistency in Push and Job Status update (Diamond Lewis) [#7267](https://github.com/parse-community/parse-server/pull/7267) - Excluding keys that have trailing edges.node when performing GraphQL resolver (Chris Bland) [#7273](https://github.com/parse-community/parse-server/pull/7273) - Added centralized feature deprecation with standardized warning logs (Manuel Trezza) [#7303](https://github.com/parse-community/parse-server/pull/7303) +- Use Node.js 15.13.0 in CI (Olle Jonsson) [#7312](https://github.com/parse-community/parse-server/pull/7312) +- Fix file upload issue for S3 compatible storage (Linode, DigitalOcean) by avoiding empty tags property when creating a file (Ali Oguzhan Yildiz) [#7300](https://github.com/parse-community/parse-server/pull/7300) ___ ## 4.5.0 [Full Changelog](https://github.com/parse-community/parse-server/compare/4.4.0...4.5.0) diff --git a/README.md b/README.md index 54099f5793..2e4ccfb9c9 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ npm version Join the conversation Snyk badge - Node.js 10,12,14,15 + Node.js 12,14,15 MongoDB 3.6,4.0,4.2,4.4 PostgreSQL 10,11,12,13

@@ -113,10 +113,9 @@ Parse Server is continuously tested with the most recent releases of Node.js to | Version | Latest Patch Version | End-of-Life Date | Compatibility | |------------|----------------------|------------------|--------------------| -| Node.js 10 | 10.24.0 | April 2021 | ✅ Fully compatible | -| Node.js 12 | 12.21.0 | April 2022 | ✅ Fully compatible | +| Node.js 12 | 12.22.0 | April 2022 | ✅ Fully compatible | | Node.js 14 | 14.16.0 | April 2023 | ✅ Fully compatible | -| Node.js 15 | 15.12.0 | June 2021 | ✅ Fully compatible | +| Node.js 15 | 15.13.0 | June 2021 | ✅ Fully compatible | #### MongoDB Parse Server is continuously tested with the most recent releases of MongoDB to ensure compatibility. We follow the [MongoDB support schedule](https://www.mongodb.com/support-policy) and only test against versions that are officially supported and have not reached their end-of-life date. diff --git a/resources/ci/ciCheck.js b/resources/ci/ciCheck.js index 66ee6d9aa0..0686931833 100644 --- a/resources/ci/ciCheck.js +++ b/resources/ci/ciCheck.js @@ -59,8 +59,7 @@ async function checkNodeVersions() { releasedVersions, latestComponent: CiVersionCheck.versionComponents.minor, ignoreReleasedVersions: [ - '<10.0.0', // These versions have reached their end-of-life support date - '>=11.0.0 <12.0.0', // These versions have reached their end-of-life support date + '<12.0.0', // These versions have reached their end-of-life support date '>=13.0.0 <14.0.0', // These versions have reached their end-of-life support date '>=16.0.0', // This version has not been officially released yet ], diff --git a/spec/ParseFile.spec.js b/spec/ParseFile.spec.js index b55dd7404a..af1de35ee7 100644 --- a/spec/ParseFile.spec.js +++ b/spec/ParseFile.spec.js @@ -3,6 +3,7 @@ 'use strict'; +const { FilesController } = require('../lib/Controllers/FilesController'); const request = require('../lib/request'); const str = 'Hello World!'; @@ -205,6 +206,34 @@ describe('Parse.File testing', () => { notEqual(file.name(), 'hello.txt'); }); + it('saves the file with tags', async () => { + spyOn(FilesController.prototype, 'createFile').and.callThrough(); + const file = new Parse.File('hello.txt', data, 'text/plain'); + const tags = { hello: 'world' }; + file.setTags(tags); + expect(file.url()).toBeUndefined(); + const result = await file.save(); + expect(file.name()).toBeDefined(); + expect(file.url()).toBeDefined(); + expect(result.tags()).toEqual(tags); + expect(FilesController.prototype.createFile.calls.argsFor(0)[4]).toEqual({ + tags: tags, + metadata: {}, + }); + }); + + it('does not pass empty file tags while saving', async () => { + spyOn(FilesController.prototype, 'createFile').and.callThrough(); + const file = new Parse.File('hello.txt', data, 'text/plain'); + expect(file.url()).toBeUndefined(); + expect(file.name()).toBeDefined(); + await file.save(); + expect(file.url()).toBeDefined(); + expect(FilesController.prototype.createFile.calls.argsFor(0)[4]).toEqual({ + metadata: {}, + }); + }); + it('save file in object', async done => { const file = new Parse.File('hello.txt', data, 'text/plain'); ok(!file.url()); diff --git a/src/Routers/FilesRouter.js b/src/Routers/FilesRouter.js index df768e6d0b..c0c7e00f13 100644 --- a/src/Routers/FilesRouter.js +++ b/src/Routers/FilesRouter.js @@ -166,16 +166,22 @@ export class FilesRouter { // update fileSize const bufferData = Buffer.from(fileObject.file._data, 'base64'); fileObject.fileSize = Buffer.byteLength(bufferData); + // prepare file options + const fileOptions = { + metadata: fileObject.file._metadata, + }; + // some s3-compatible providers (DigitalOcean, Linode) do not accept tags + // so we do not include the tags option if it is empty. + const fileTags = + Object.keys(fileObject.file._tags).length > 0 ? { tags: fileObject.file._tags } : {}; + Object.assign(fileOptions, fileTags); // save file const createFileResult = await filesController.createFile( config, fileObject.file._name, bufferData, fileObject.file._source.type, - { - tags: fileObject.file._tags, - metadata: fileObject.file._metadata, - } + fileOptions ); // update file with new data fileObject.file._name = createFileResult.name;