gregnb / filemanager-webpack-plugin

Copy, move, archive (zip/tar/tar.gz), delete files and directories before and after Webpack builds. Win32/Mac/*Nix supported
MIT License
463 stars 34 forks source link

Unable to copy file at WebDAV location #92

Closed RomanYegay closed 3 years ago

RomanYegay commented 3 years ago

Config

Version 3.0.0-alpha.2 (works):

new FileManagerPlugin({
  onEnd: {
    copy: AutoDeploy
      ? [
          {
            source: path.join(__dirname, "./dist/" + SiteRoot + AppConfig.WorkFolder + "/" + BundleFile + ".js"),
            destination: "\\\\" + SiteRoot + "@SSL\\DavWWWRoot" + AppConfig.WorkFolder.replace("/", "\\") + "\\",
          },
        ]
      : [{ source: "", destination: "" }],
  },
});

Version 3.1 (doesn't work):

new FileManagerPlugin({
  events: {
    onEnd: {
      copy: AutoDeploy
        ? [
            {
              source: path.join(__dirname, "./dist/" + SiteRoot + AppConfig.WorkFolder + "/" + BundleFile + ".js"),
              destination: "\\\\" + SiteRoot + "@SSL\\DavWWWRoot" + AppConfig.WorkFolder.replace("/", "\\") + "\\",
            },
          ]
        : [{ source: "", destination: "" }],
    },
  },
});

Issue

I am using plugin version 3.0.0-alpha.2 to copy files at prod server using WebDAV destination like "\\site.com@SSL\DavWWWRoot\folder\", however after updrade to version 3.1 copy is failed by unknown reason.

Your Environment

Tech Version
filemanager-plugin-webpack 3.1
node 12.2.0
OS Windows 10
sibiraj-s commented 3 years ago

@RomanYegay Can you post the error message you get?

RomanYegay commented 3 years ago

@sibiraj-s There was no error in console. However, after some research I've found that version 3.0.0-alpha.2 accepts improperly formatted WebDAV destination (like \www.site.com@SSL\DavWWWRoot\level1/level2/level), while version 3.1 doesn't. So this is mostly my fault, sorry.

PS: while testing found another issue, plugin can't copy absolute file names with glob pattern, i.e. source: './dist/' + SiteRoot + AppConfig.WorkFolder + '/') + BundleFile + '.{js,css}' will copy file, but source: 'C:/temp/test/dist/' + SiteRoot + AppConfig.WorkFolder + '/') + BundleFile + '.{js,css}' will not In this case there is no any error message also.

sibiraj-s commented 3 years ago

Cool. Glad the issue is fixed. I will close this one.

Regarding the other issue. I think it could be from here https://github.com/gregnb/filemanager-webpack-plugin/blob/master/src/actions/copy.js#L20. We are joining path with context. but actually we should check if path is absolute and then process. Feel free to open a new issue for this. I am occupied at the moment. I will work on this this weekend. meanwhile PR's are welcome.