|
|
@@ -8,7 +8,6 @@ import { importPackageJson, validateGrowiDirective } from '@growi/pluginkit/dist
|
|
|
// eslint-disable-next-line no-restricted-imports
|
|
|
import axios from 'axios';
|
|
|
import mongoose from 'mongoose';
|
|
|
-import sanitize from 'sanitize-filename';
|
|
|
import streamToPromise from 'stream-to-promise';
|
|
|
import unzipStream from 'unzip-stream';
|
|
|
|
|
|
@@ -77,11 +76,11 @@ export class GrowiPluginService implements IGrowiPluginService {
|
|
|
|
|
|
// TODO: imprv Document version and repository version possibly different.
|
|
|
const ghUrl = new GitHubUrl(growiPlugin.origin.url, growiPlugin.origin.ghBranch);
|
|
|
- const { reposName, branchName, archiveUrl } = ghUrl;
|
|
|
+ const { reposName, archiveUrl, extractedArchiveDirName } = ghUrl;
|
|
|
|
|
|
- const zipFilePath = path.join(PLUGIN_STORING_PATH, `${branchName}.zip`);
|
|
|
+ const zipFilePath = path.join(PLUGIN_STORING_PATH, `${extractedArchiveDirName}.zip`);
|
|
|
const unzippedPath = PLUGIN_STORING_PATH;
|
|
|
- const unzippedReposPath = path.join(PLUGIN_STORING_PATH, `${reposName}-${branchName}`);
|
|
|
+ const unzippedReposPath = path.join(PLUGIN_STORING_PATH, `${reposName}-${extractedArchiveDirName}`);
|
|
|
|
|
|
try {
|
|
|
// download github repository to local file system
|
|
|
@@ -111,16 +110,14 @@ export class GrowiPluginService implements IGrowiPluginService {
|
|
|
async install(origin: IGrowiPluginOrigin): Promise<string> {
|
|
|
const ghUrl = new GitHubUrl(origin.url, origin.ghBranch);
|
|
|
const {
|
|
|
- organizationName, reposName, branchName, archiveUrl,
|
|
|
+ organizationName, reposName, archiveUrl, extractedArchiveDirName,
|
|
|
} = ghUrl;
|
|
|
|
|
|
- const sanitizedBranchName = sanitize(branchName);
|
|
|
-
|
|
|
const installedPath = `${organizationName}/${reposName}`;
|
|
|
|
|
|
const organizationPath = path.join(PLUGIN_STORING_PATH, organizationName);
|
|
|
- const zipFilePath = path.join(organizationPath, `${reposName}-${sanitizedBranchName}.zip`);
|
|
|
- const temporaryReposPath = path.join(organizationPath, `${reposName}-${sanitizedBranchName}`);
|
|
|
+ const zipFilePath = path.join(organizationPath, `${reposName}-${extractedArchiveDirName}.zip`);
|
|
|
+ const temporaryReposPath = path.join(organizationPath, `${reposName}-${extractedArchiveDirName}`);
|
|
|
const reposPath = path.join(organizationPath, reposName);
|
|
|
|
|
|
if (!fs.existsSync(organizationPath)) fs.mkdirSync(organizationPath);
|