@uppy/utils
Advanced tools
Comparing version 4.1.2 to 4.1.3
# @uppy/utils | ||
## 4.1.3 | ||
Released: 2022-08-30 | ||
Included in: Uppy v2.13.5 | ||
- @uppy/utils: fix `relativePath` when drag&dropping a folder (Antoine du Hamel / #4043) | ||
## 4.1.2 | ||
@@ -4,0 +11,0 @@ |
"use strict"; | ||
const getRelativePath = require("./getRelativePath.js"); | ||
const getFilesAndDirectoriesFromDirectory = require("./getFilesAndDirectoriesFromDirectory.js"); | ||
@@ -16,2 +14,3 @@ /** | ||
kind: entry.isFile ? 'file' : entry.isDirectory ? 'directory' : undefined, | ||
name: entry.name, | ||
@@ -36,3 +35,3 @@ getFile() { | ||
async function* createPromiseToAddFileOrParseDirectory(entry) { | ||
async function* createPromiseToAddFileOrParseDirectory(entry, relativePath) { | ||
// For each dropped item, - make sure it's a file/directory, and start deepening in! | ||
@@ -43,3 +42,3 @@ if (entry.kind === 'file') { | ||
if (file !== null) { | ||
file.relativePath = getRelativePath(entry); | ||
file.relativePath = relativePath ? `${relativePath}/${entry.name}` : null; | ||
yield file; | ||
@@ -49,3 +48,3 @@ } | ||
for await (const handle of entry.values()) { | ||
yield* createPromiseToAddFileOrParseDirectory(handle); | ||
yield* createPromiseToAddFileOrParseDirectory(handle, `${relativePath}/${entry.name}`); | ||
} | ||
@@ -75,3 +74,3 @@ } | ||
try { | ||
yield* createPromiseToAddFileOrParseDirectory(entry, logDropError); | ||
yield* createPromiseToAddFileOrParseDirectory(entry, ''); | ||
} catch (err) { | ||
@@ -78,0 +77,0 @@ if (lastResortFile) { |
{ | ||
"name": "@uppy/utils", | ||
"description": "Shared utility functions for Uppy Core and plugins maintained by the Uppy team.", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -1,2 +0,1 @@ | ||
import getRelativePath from './getRelativePath.js' | ||
import getFilesAndDirectoriesFromDirectory from './getFilesAndDirectoriesFromDirectory.js' | ||
@@ -12,2 +11,3 @@ | ||
kind: entry.isFile ? 'file' : entry.isDirectory ? 'directory' : undefined, | ||
name: entry.name, | ||
getFile () { | ||
@@ -29,3 +29,3 @@ return new Promise((resolve, reject) => entry.file(resolve, reject)) | ||
async function* createPromiseToAddFileOrParseDirectory (entry) { | ||
async function* createPromiseToAddFileOrParseDirectory (entry, relativePath) { | ||
// For each dropped item, - make sure it's a file/directory, and start deepening in! | ||
@@ -35,3 +35,3 @@ if (entry.kind === 'file') { | ||
if (file !== null) { | ||
file.relativePath = getRelativePath(entry) | ||
file.relativePath = relativePath ? `${relativePath}/${entry.name}` : null | ||
yield file | ||
@@ -41,3 +41,3 @@ } | ||
for await (const handle of entry.values()) { | ||
yield* createPromiseToAddFileOrParseDirectory(handle) | ||
yield* createPromiseToAddFileOrParseDirectory(handle, `${relativePath}/${entry.name}`) | ||
} | ||
@@ -60,3 +60,3 @@ } | ||
try { | ||
yield* createPromiseToAddFileOrParseDirectory(entry, logDropError) | ||
yield* createPromiseToAddFileOrParseDirectory(entry, '') | ||
} catch (err) { | ||
@@ -63,0 +63,0 @@ if (lastResortFile) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
235524
179
3258