Browse Source

feat(nocodb): write temp file to os.tmpdir() instead of process.cwd

pull/4359/head
Wing-Kam Wong 2 years ago
parent
commit
18758cb829
  1. 3
      packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts
  2. 3
      packages/nocodb/src/lib/plugins/gcs/Gcs.ts
  3. 3
      packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts
  4. 3
      packages/nocodb/src/lib/plugins/mino/Minio.ts
  5. 3
      packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts
  6. 3
      packages/nocodb/src/lib/plugins/s3/S3.ts
  7. 3
      packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts
  8. 3
      packages/nocodb/src/lib/plugins/spaces/Spaces.ts
  9. 3
      packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts
  10. 3
      packages/nocodb/src/lib/plugins/vultr/Vultr.ts

3
packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -119,7 +120,7 @@ export default class Backblaze implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/gcs/Gcs.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import { Storage, StorageOptions } from '@google-cloud/storage';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -85,7 +86,7 @@ export default class Gcs implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -109,7 +110,7 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/mino/Minio.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import { Client as MinioClient } from 'minio';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -73,7 +74,7 @@ export default class Minio implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -109,7 +110,7 @@ export default class OvhCloud implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/s3/S3.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -112,7 +113,7 @@ export default class S3 implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts

@ -1,5 +1,6 @@
import path from 'path';
import fs from 'fs';
import os from 'os';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import AWS from 'aws-sdk';
import request from 'request';
@ -29,7 +30,7 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/spaces/Spaces.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -117,7 +118,7 @@ export default class Spaces implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -107,7 +108,7 @@ export default class UpoCloud implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

3
packages/nocodb/src/lib/plugins/vultr/Vultr.ts

@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import os from 'os';
import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request';
@ -109,7 +110,7 @@ export default class Vultr implements IStorageAdapterV2 {
public async test(): Promise<boolean> {
try {
const tempFile = path.join(process.cwd(), 'temp.txt');
const tempFile = path.join(os.tmpdir(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile);
await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', {

Loading…
Cancel
Save