mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(Google Drive Node): Fix regex in file RLC (#6607)
This commit is contained in:
@@ -13,6 +13,7 @@ import { extractId, googleApiRequest, googleApiRequestAllItems } from './v1/Gene
|
|||||||
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { fileSearch, folderSearch } from './v1/SearchFunctions';
|
import { fileSearch, folderSearch } from './v1/SearchFunctions';
|
||||||
|
import { GOOGLE_DRIVE_FILE_URL_REGEX, GOOGLE_DRIVE_FOLDER_URL_REGEX } from '../constants';
|
||||||
|
|
||||||
export class GoogleDriveTrigger implements INodeType {
|
export class GoogleDriveTrigger implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
@@ -112,15 +113,13 @@ export class GoogleDriveTrigger implements INodeType {
|
|||||||
placeholder: 'https://drive.google.com/file/d/1wroCSfK-hupQIYf_xzeoUEzOhvfTFH2P/edit',
|
placeholder: 'https://drive.google.com/file/d/1wroCSfK-hupQIYf_xzeoUEzOhvfTFH2P/edit',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google\\.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive File URL',
|
errorMessage: 'Not a valid Google Drive File URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -192,15 +191,13 @@ export class GoogleDriveTrigger implements INodeType {
|
|||||||
placeholder: 'https://drive.google.com/drive/folders/1Tx9WHbA3wBpPB4C_HcoZDH9WZFWYxAMU',
|
placeholder: 'https://drive.google.com/drive/folders/1Tx9WHbA3wBpPB4C_HcoZDH9WZFWYxAMU',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive Folder URL',
|
errorMessage: 'Not a valid Google Drive Folder URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import type { Readable } from 'stream';
|
|||||||
import { driveSearch, fileSearch, folderSearch } from './SearchFunctions';
|
import { driveSearch, fileSearch, folderSearch } from './SearchFunctions';
|
||||||
|
|
||||||
import { oldVersionNotice } from '@utils/descriptions';
|
import { oldVersionNotice } from '@utils/descriptions';
|
||||||
|
import { GOOGLE_DRIVE_FILE_URL_REGEX, GOOGLE_DRIVE_FOLDER_URL_REGEX } from '../../constants';
|
||||||
|
|
||||||
const UPLOAD_CHUNK_SIZE = 256 * 1024;
|
const UPLOAD_CHUNK_SIZE = 256 * 1024;
|
||||||
|
|
||||||
@@ -242,15 +243,13 @@ const versionDescription: INodeTypeDescription = {
|
|||||||
'https://drive.google.com/file/d/1anGBg0b5re2VtF2bKu201_a-Vnz5BHq9Y4r-yBDAj5A/edit',
|
'https://drive.google.com/file/d/1anGBg0b5re2VtF2bKu201_a-Vnz5BHq9Y4r-yBDAj5A/edit',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google\\.com\\/\\w+\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google.com\\/\\w+\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive File URL',
|
errorMessage: 'Not a valid Google Drive File URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -306,15 +305,13 @@ const versionDescription: INodeTypeDescription = {
|
|||||||
placeholder: 'https://drive.google.com/drive/folders/1Tx9WHbA3wBpPB4C_HcoZDH9WZFWYxAMU',
|
placeholder: 'https://drive.google.com/drive/folders/1Tx9WHbA3wBpPB4C_HcoZDH9WZFWYxAMU',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com\\/\\w+\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com\\/\\w+\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive Folder URL',
|
errorMessage: 'Not a valid Google Drive Folder URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -1489,15 +1486,13 @@ const versionDescription: INodeTypeDescription = {
|
|||||||
placeholder: 'https://drive.google.com/drive/folders/0AaaaaAAAAAAAaa',
|
placeholder: 'https://drive.google.com/drive/folders/0AaaaaAAAAAAAaa',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com\\/\\w+\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com\\/\\w+\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive Drive URL',
|
errorMessage: 'Not a valid Google Drive Drive URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import type { INodeProperties } from 'n8n-workflow';
|
import type { INodeProperties } from 'n8n-workflow';
|
||||||
import { DRIVE, RLC_DRIVE_DEFAULT } from '../helpers/interfaces';
|
import { DRIVE, RLC_DRIVE_DEFAULT } from '../helpers/interfaces';
|
||||||
|
import { GOOGLE_DRIVE_FILE_URL_REGEX, GOOGLE_DRIVE_FOLDER_URL_REGEX } from '../../../constants';
|
||||||
|
|
||||||
export const fileRLC: INodeProperties = {
|
export const fileRLC: INodeProperties = {
|
||||||
displayName: 'File',
|
displayName: 'File',
|
||||||
@@ -26,15 +27,13 @@ export const fileRLC: INodeProperties = {
|
|||||||
'e.g. https://drive.google.com/file/d/1anGBg0b5re2VtF2bKu201_a-Vnz5BHq9Y4r-yBDAj5A/edit',
|
'e.g. https://drive.google.com/file/d/1anGBg0b5re2VtF2bKu201_a-Vnz5BHq9Y4r-yBDAj5A/edit',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google\\.com\\/\\w+\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google.com\\/\\w+\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive File URL',
|
errorMessage: 'Not a valid Google Drive File URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -84,15 +83,13 @@ export const folderNoRootRLC: INodeProperties = {
|
|||||||
placeholder: 'e.g. https://drive.google.com/drive/folders/1Tx9WHbA3wBpPB4C_HcoZDH9WZFWYxAMU',
|
placeholder: 'e.g. https://drive.google.com/drive/folders/1Tx9WHbA3wBpPB4C_HcoZDH9WZFWYxAMU',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive Folder URL',
|
errorMessage: 'Not a valid Google Drive Folder URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -142,15 +139,13 @@ export const folderRLC: INodeProperties = {
|
|||||||
placeholder: 'e.g. https://drive.google.com/drive/folders/1Tx9WHbA3wBpPB4C_HcoZDH9WZFWYxAMU',
|
placeholder: 'e.g. https://drive.google.com/drive/folders/1Tx9WHbA3wBpPB4C_HcoZDH9WZFWYxAMU',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive Folder URL',
|
errorMessage: 'Not a valid Google Drive Folder URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -200,15 +195,13 @@ export const driveRLC: INodeProperties = {
|
|||||||
placeholder: 'https://drive.google.com/drive/folders/0AaaaaAAAAAAAaa',
|
placeholder: 'https://drive.google.com/drive/folders/0AaaaaAAAAAAAaa',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive Drive URL',
|
errorMessage: 'Not a valid Google Drive Drive URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -258,15 +251,13 @@ export const sharedDriveRLC: INodeProperties = {
|
|||||||
placeholder: 'e.g. https://drive.google.com/drive/u/1/folders/0AIjtcbwnjtcbwn9PVA',
|
placeholder: 'e.g. https://drive.google.com/drive/u/1/folders/0AIjtcbwnjtcbwn9PVA',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FOLDER_URL_REGEX,
|
||||||
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive Drive URL',
|
errorMessage: 'Not a valid Google Drive Drive URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {
|
|||||||
getRevisionFile,
|
getRevisionFile,
|
||||||
sheetBinaryToArrayOfArrays,
|
sheetBinaryToArrayOfArrays,
|
||||||
} from './GoogleSheetsTrigger.utils';
|
} from './GoogleSheetsTrigger.utils';
|
||||||
|
import { GOOGLE_DRIVE_FILE_URL_REGEX } from '../constants';
|
||||||
|
|
||||||
export class GoogleSheetsTrigger implements INodeType {
|
export class GoogleSheetsTrigger implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
@@ -84,15 +85,13 @@ export class GoogleSheetsTrigger implements INodeType {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google\\.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive File URL',
|
errorMessage: 'Not a valid Google Drive File URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import * as del from './delete.operation';
|
|||||||
import * as read from './read.operation';
|
import * as read from './read.operation';
|
||||||
import * as remove from './remove.operation';
|
import * as remove from './remove.operation';
|
||||||
import * as update from './update.operation';
|
import * as update from './update.operation';
|
||||||
|
import { GOOGLE_DRIVE_FILE_URL_REGEX } from '../../../../constants';
|
||||||
|
|
||||||
export { append, appendOrUpdate, clear, create, del as delete, read, remove, update };
|
export { append, appendOrUpdate, clear, create, del as delete, read, remove, update };
|
||||||
|
|
||||||
@@ -96,15 +97,13 @@ export const descriptions: INodeProperties[] = [
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google\\.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive File URL',
|
errorMessage: 'Not a valid Google Drive File URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||||
import type { SpreadSheetProperties } from '../../helpers/GoogleSheets.types';
|
import type { SpreadSheetProperties } from '../../helpers/GoogleSheets.types';
|
||||||
import { apiRequest } from '../../transport';
|
import { apiRequest } from '../../transport';
|
||||||
|
import { GOOGLE_DRIVE_FILE_URL_REGEX } from '../../../../constants';
|
||||||
|
|
||||||
export const description: SpreadSheetProperties = [
|
export const description: SpreadSheetProperties = [
|
||||||
// {
|
// {
|
||||||
@@ -37,15 +38,13 @@ export const description: SpreadSheetProperties = [
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
extractValue: {
|
extractValue: {
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google\\.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
},
|
},
|
||||||
validation: [
|
validation: [
|
||||||
{
|
{
|
||||||
type: 'regex',
|
type: 'regex',
|
||||||
properties: {
|
properties: {
|
||||||
regex:
|
regex: GOOGLE_DRIVE_FILE_URL_REGEX,
|
||||||
'https:\\/\\/(?:drive|docs)\\.google.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)',
|
|
||||||
errorMessage: 'Not a valid Google Drive File URL',
|
errorMessage: 'Not a valid Google Drive File URL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
5
packages/nodes-base/nodes/Google/constants.ts
Normal file
5
packages/nodes-base/nodes/Google/constants.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export const GOOGLE_DRIVE_FILE_URL_REGEX =
|
||||||
|
'https:\\/\\/(?:drive|docs)\\.google\\.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)';
|
||||||
|
|
||||||
|
export const GOOGLE_DRIVE_FOLDER_URL_REGEX =
|
||||||
|
'https:\\/\\/drive\\.google\\.com(?:\\/.*|)\\/folders\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)';
|
||||||
Reference in New Issue
Block a user