Просмотр исходного кода

remove unnecessary escape for regex

Futa Arai 8 месяцев назад
Родитель
Сommit
ee5d4abfb4
1 измененных файлов с 1 добавлено и 4 удалено
  1. 1 4
      apps/pdf-converter/src/service/pdf-convert.ts

+ 1 - 4
apps/pdf-converter/src/service/pdf-convert.ts

@@ -44,8 +44,6 @@ class PdfConvertService implements OnInit {
 
 
   private tmpOutputRootDir = '/tmp/page-bulk-export';
   private tmpOutputRootDir = '/tmp/page-bulk-export';
 
 
-  private tmpHtmlDir = `${this.tmpOutputRootDir}/html`;
-
   private jobList: {
   private jobList: {
     [key: string]: JobInfo;
     [key: string]: JobInfo;
   } = {};
   } = {};
@@ -225,12 +223,11 @@ class PdfConvertService implements OnInit {
    * @returns writable stream
    * @returns writable stream
    */
    */
   private getPdfWritable(): Writable {
   private getPdfWritable(): Writable {
-    const escapedRoot = this.tmpOutputRootDir.replace(/\//g, '\\/');
     return new Writable({
     return new Writable({
       objectMode: true,
       objectMode: true,
       write: async (pageInfo: PageInfo, encoding, callback) => {
       write: async (pageInfo: PageInfo, encoding, callback) => {
         const pattern = new RegExp(
         const pattern = new RegExp(
-          `^${escapedRoot}(?:\\/([0-9]+))?\\/html\\/(.+?)\\.html$`,
+          `^${this.tmpOutputRootDir}(?:\\/([0-9]+))?\\/html\\/(.+?)\\.html$`,
         );
         );
 
 
         const match = pageInfo.htmlFilePath.match(pattern);
         const match = pageInfo.htmlFilePath.match(pattern);