tableau / TabMigrate

A lightweight tool for moving Tableau content between multiple Tableau Server environments
MIT License
119 stars 59 forks source link

Does not work for workbook names having dots (.) like BMS_ver_2.98.twbx #2

Closed jmmejias closed 8 years ago

benlower commented 8 years ago

@jmmejias sorry for the delay but I'm just seeing this. did you happen to find the offending code in the project? have a PR that fixes it? :)

ghost commented 8 years ago

@jmmejias - I just tried it with a Workbook with filename "BMS_ver_2.twbx" published into a server project called "Test". -- It worked correctly on my machine. Could you copy/paste the status & error data (shown in the textboxes at the bottom of the app UI). That should give some useful information to track down what's going on. thanks, -ivo

benlower commented 8 years ago

@IvoSalmreTableau I was able to repro this. Rename your file to something that includes a dot in the file name (in addition to the dot separating file extension). e.g. "BMS_ver.2.twbx".

ghost commented 8 years ago

@jmmejias @benlower - This should work correctly. I just made a fix (for the other reported issue) to correctly deal with Windows file system reserved characters (e.g. \ / *, quote). I wonder whether this scenario was related to the behavior seen here? - In any case, let me know if you are still seeing a problem here when using the latest release. (If you do, copy/paste the code from the output windows -- that may be useful in diagnosing any problem). thanks, -ivo

graham-macleod commented 8 years ago

@IvoSalmreTableau the offending piece of code appears to be in the TableauServerSignedInRequestBase class in the DownloadFile_inner() method.

baseFilename =  FileIOHelper.GenerateWindowsSafeFilename(System.IO.Path.GetFileNameWithoutExtension(baseFilename));

The problem is, at this point, there is no file suffix because the baseFilename only contains the name of the datasource/workbook and not the filename (or so my testing has shown, perhaps it was intended to be a multipurpose function but the DownloadFile() method only seems to be referenced by DownloadWorkbooks() and DownloadDatasources() at the moment).

I changed the line to

baseFilename =  FileIOHelper.GenerateWindowsSafeFilename(baseFilename);

and it didn't seem to suffer any ill effects and the results were as desired.

ghost commented 8 years ago

@graham-macleod -- Thanks, appreciated. Yes, I totally agree with you. I recently made just that fix to the code and added comments.

    //[2016-05-06] Interestingly 'GetFileNameWithoutExtension' does more than remove a ".xxxx" extension; it will also remove a preceding
    //            path (e.g. GetFileNameWithoutExtension('foo/bar.xxx') -> "bar'.  This is undesirable because these characters are valid 
    //            in Tableau Server content names. Since this function is supposed to be called with a 'baseFilename' that DOES NOT have a .xxx
    //            extension, it is safe to remove this call
    //baseFilename =  FileIOHelper.GenerateWindowsSafeFilename(System.IO.Path.GetFileNameWithoutExtension(baseFilename));

    //Strip off an extension if its there
    baseFilename = FileIOHelper.GenerateWindowsSafeFilename(baseFilename);
pporada-gl commented 8 years ago

Is this going to be merged in?

ghost commented 8 years ago

This should be fixed now (in the most recent release). Let me know if you still see any problems.