🐛 fixes bug with latin characters (#758)

This commit is contained in:
Ricardo Espinoza 2020-07-15 03:52:28 -04:00 committed by GitHub
parent 25cc745894
commit cf1e4468bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@ import {
BINARY_ENCODING, BINARY_ENCODING,
IExecuteFunctions, IExecuteFunctions,
} from 'n8n-core'; } from 'n8n-core';
import { import {
IDataObject, IDataObject,
INodeTypeDescription, INodeTypeDescription,
@ -9,8 +10,9 @@ import {
INodeType, INodeType,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { OptionsWithUri } from 'request'; import {
OptionsWithUri
} from 'request';
export class Dropbox implements INodeType { export class Dropbox implements INodeType {
description: INodeTypeDescription = { description: INodeTypeDescription = {
@ -23,7 +25,7 @@ export class Dropbox implements INodeType {
description: 'Access data on Dropbox', description: 'Access data on Dropbox',
defaults: { defaults: {
name: 'Dropbox', name: 'Dropbox',
color: '#22BB44', color: '#0061FF',
}, },
inputs: ['main'], inputs: ['main'],
outputs: ['main'], outputs: ['main'],
@ -454,6 +456,7 @@ export class Dropbox implements INodeType {
let requestMethod = ''; let requestMethod = '';
let body: IDataObject | Buffer; let body: IDataObject | Buffer;
let isJson = false; let isJson = false;
let query: IDataObject = {};
let headers: IDataObject; let headers: IDataObject;
@ -470,8 +473,9 @@ export class Dropbox implements INodeType {
// ---------------------------------- // ----------------------------------
requestMethod = 'POST'; requestMethod = 'POST';
headers['Dropbox-API-Arg'] = JSON.stringify({
path: this.getNodeParameter('path', i) as string, query.arg = JSON.stringify({
path: this.getNodeParameter('path', i) as string
}); });
endpoint = 'https://content.dropboxapi.com/2/files/download'; endpoint = 'https://content.dropboxapi.com/2/files/download';
@ -483,9 +487,10 @@ export class Dropbox implements INodeType {
requestMethod = 'POST'; requestMethod = 'POST';
headers['Content-Type'] = 'application/octet-stream'; headers['Content-Type'] = 'application/octet-stream';
headers['Dropbox-API-Arg'] = JSON.stringify({
query.arg = JSON.stringify({
mode: 'overwrite', mode: 'overwrite',
path: this.getNodeParameter('path', i) as string, path: this.getNodeParameter('path', i) as string
}); });
endpoint = 'https://content.dropboxapi.com/2/files/upload'; endpoint = 'https://content.dropboxapi.com/2/files/upload';
@ -594,8 +599,8 @@ export class Dropbox implements INodeType {
const options: OptionsWithUri = { const options: OptionsWithUri = {
headers, headers,
method: requestMethod, method: requestMethod,
qs: {},
uri: endpoint, uri: endpoint,
qs: query,
json: isJson, json: isJson,
}; };