cristianbuse / VBA-FileTools

Useful methods for interacting with the file system
MIT License
81 stars 23 forks source link

Local/Remote Path Conversion Bug #26

Closed zhona9 closed 2 months ago

zhona9 commented 2 months ago

This is my Diagnostics, I am not having any issues. The correct local path is returned. AmeliaDiagnosticsOD.txt

This the Diagnostics for the user having issues. For her, the local path returned is "". YannTyngDiagnosticsOD.txt

cristianbuse commented 2 months ago

@zhona9

I tried both files and GetLocalPath works fine with both configurations when I ask for "https://south32.sharepoint.com/sites/ContinuousImprovementProjects-119ExtendMENDchecklisttoMetals/Shared Documents/119 Extend MEND checklist to Metals"

Please see my comment on Guido's gist regarding the weird character.

cristianbuse commented 2 months ago

Hi @zhona9 ,

I am not sure you saw the comment I left in Guido's gist last week so I am copying the comment below:

I simply cannot replicate the issue. I used the data in both diagnostics files you've sent and they both work fine. In lack of other ideas I tought that maybe character 160 is the issue although I saw that it literally is at line break.

m_providers.arr(i) has an array item 1, yet it throws runtime error 1004 "Application-defined or object-defined error". This doesn't happen when I run the code at all. I think after that the path becomes an empty string.

This is super weird. It could be a compilation bug in VBA. What happens if you replace this:

        With m_providers.arr(i)
            If StrCompLeft(odWebPath, .webPath, vbTextCompare) = 0 Then
                collMatches.Add i
                If Not .isBusiness Then Exit For
                If .isMain Then mainIndex = .accountIndex
            End If
        End With

with this:

        If StrCompLeft(odWebPath, m_providers.arr(i).webPath, vbTextCompare) = 0 Then
            collMatches.Add i
            If Not m_providers.arr(i).isBusiness Then Exit For
            If m_providers.arr(i).isMain Then mainIndex = m_providers.arr(i).accountIndex
        End If

?

zhona9 commented 2 months ago

Thanks Cristian, I will schedule a time with the user to test this code. Apologies for the delay.

cristianbuse commented 2 months ago

Fixed in e299cecbfe3d44a8da99f6a271f66edc9c6746df