mirror of
https://github.com/outline/outline.git
synced 2026-06-13 19:35:02 +03:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dac8843934 |
@@ -55,10 +55,10 @@ export function Integrations() {
|
||||
</StickyFilters>
|
||||
|
||||
<Cards gap={30} wrap>
|
||||
{groupedItems.connected?.map((item) => (
|
||||
{groupedItems.connected.map((item) => (
|
||||
<IntegrationCard key={item.path} integration={item} isConnected />
|
||||
))}
|
||||
{groupedItems.available?.map((item) => (
|
||||
{groupedItems.available.map((item) => (
|
||||
<IntegrationCard key={item.path} integration={item} />
|
||||
))}
|
||||
</Cards>
|
||||
|
||||
+28
-54
@@ -41,7 +41,7 @@ export default class ZipHelper {
|
||||
prefix: "export-",
|
||||
postfix: ".zip",
|
||||
},
|
||||
(err, filePath) => {
|
||||
(err, path) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
@@ -51,24 +51,13 @@ export default class ZipHelper {
|
||||
currentFile: null,
|
||||
};
|
||||
|
||||
const handleError = (error: Error) => {
|
||||
dest.destroy();
|
||||
fs.remove(filePath)
|
||||
.catch((rmErr) => {
|
||||
Logger.error("Failed to remove tmp file", rmErr);
|
||||
})
|
||||
.finally(() => {
|
||||
reject(error);
|
||||
});
|
||||
};
|
||||
|
||||
const dest = fs
|
||||
.createWriteStream(filePath)
|
||||
.createWriteStream(path)
|
||||
.on("finish", () => {
|
||||
Logger.debug("utils", "Writing zip complete", { path: filePath });
|
||||
return resolve(filePath);
|
||||
Logger.debug("utils", "Writing zip complete", { path });
|
||||
return resolve(path);
|
||||
})
|
||||
.on("error", handleError);
|
||||
.on("error", reject);
|
||||
|
||||
zip
|
||||
.generateNodeStream(
|
||||
@@ -96,9 +85,11 @@ export default class ZipHelper {
|
||||
}
|
||||
}
|
||||
)
|
||||
.on("error", handleError)
|
||||
.pipe(dest)
|
||||
.on("error", handleError);
|
||||
.on("error", (rErr) => {
|
||||
dest.end();
|
||||
reject(rErr);
|
||||
})
|
||||
.pipe(dest);
|
||||
}
|
||||
);
|
||||
});
|
||||
@@ -135,38 +126,32 @@ export default class ZipHelper {
|
||||
const fileName = Buffer.from(entry.fileName).toString("utf8");
|
||||
Logger.debug("utils", "Extracting zip entry", { fileName });
|
||||
|
||||
const processNext = (error?: NodeJS.ErrnoException | null) => {
|
||||
if (error) {
|
||||
zipfile.close();
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
zipfile.readEntry();
|
||||
};
|
||||
|
||||
if (validateFileName(fileName)) {
|
||||
Logger.warn("Invalid zip entry", { fileName });
|
||||
processNext();
|
||||
return;
|
||||
}
|
||||
|
||||
if (/\/$/.test(fileName)) {
|
||||
zipfile.readEntry();
|
||||
} else if (/\/$/.test(fileName)) {
|
||||
// directory file names end with '/'
|
||||
fs.mkdirp(path.join(outputDir, fileName), (mkErr) =>
|
||||
processNext(mkErr)
|
||||
fs.mkdirp(
|
||||
path.join(outputDir, fileName),
|
||||
function (mErr: Error) {
|
||||
if (mErr) {
|
||||
return reject(mErr);
|
||||
}
|
||||
zipfile.readEntry();
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// file entry
|
||||
zipfile.openReadStream(entry, function (rErr, readStream) {
|
||||
if (rErr) {
|
||||
return processNext(rErr);
|
||||
return reject(rErr);
|
||||
}
|
||||
// ensure parent directory exists
|
||||
fs.mkdirp(
|
||||
path.join(outputDir, path.dirname(fileName)),
|
||||
function (mkErr) {
|
||||
if (mkErr) {
|
||||
return processNext(mkErr);
|
||||
return reject(mkErr);
|
||||
}
|
||||
|
||||
const location = trimFileAndExt(
|
||||
@@ -178,20 +163,15 @@ export default class ZipHelper {
|
||||
);
|
||||
const dest = fs
|
||||
.createWriteStream(location)
|
||||
.on("error", (error) => {
|
||||
readStream.destroy();
|
||||
dest.destroy();
|
||||
processNext(error);
|
||||
});
|
||||
.on("error", reject);
|
||||
|
||||
readStream
|
||||
.on("error", (error) => {
|
||||
dest.destroy();
|
||||
readStream.destroy();
|
||||
processNext(error);
|
||||
.on("error", (rsErr) => {
|
||||
dest.end();
|
||||
reject(rsErr);
|
||||
})
|
||||
.on("end", function () {
|
||||
processNext();
|
||||
zipfile.readEntry();
|
||||
})
|
||||
.pipe(dest);
|
||||
}
|
||||
@@ -200,14 +180,8 @@ export default class ZipHelper {
|
||||
}
|
||||
});
|
||||
zipfile.on("close", resolve);
|
||||
zipfile.on("error", (error) => {
|
||||
zipfile.close();
|
||||
reject(error);
|
||||
});
|
||||
zipfile.on("error", reject);
|
||||
} catch (zErr) {
|
||||
if (zipfile) {
|
||||
zipfile.close();
|
||||
}
|
||||
reject(zErr);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user