OCA / edi-framework

GNU Affero General Public License v3.0
6 stars 26 forks source link

[16.0][FIX] edi_storage_oca: FS find_files returns relative paths instead of full paths #64

Open JordiMForgeFlow opened 5 months ago

JordiMForgeFlow commented 5 months ago

Ex: see SFTP implementation of FS (https://filesystem-spec.readthedocs.io/en/latest/_modules/fsspec/implementations/sftp.html#SFTPFileSystem)

In the method '_decode_stat' which is used to generate the info returned by 'ls', the result is build using the relative path passed to the method 'ls': out["name"] = "/".join([parent_path.rstrip("/"), stat.filename])

simahawk commented 5 months ago

@sebalix can you review this pls?

simahawk commented 5 months ago

Probably fixed by https://github.com/OCA/edi-framework/pull/65 ?

sebalix commented 5 months ago

This PR doesn't address the same thing, I do not know enough about this EDI module but what I did in my PR is the replacement of fs_storage deprecated methods. Now I cannot say if find_files should return relative or full paths... :man_shrugging:

sebalix commented 5 months ago

@JordiMForgeFlow maybe we should include your fix in my PR (or on top of it)? Basically I moved the deprecated functions of fs_storage inside edi_storage_oca (I do not know the story, why such methods are deprecated, but we'll probably copy such convenient methods here and there, cc @simahawk )

JordiMForgeFlow commented 5 months ago

@sebalix works for me. Should I wait until your PR gets merged or do you want to apply the commit to your PR?

simahawk commented 4 months ago

@sebalix ping

simahawk commented 4 months ago

BTW I've just got another weird issue on list files https://github.com/OCA/edi-framework/pull/76

nilshamerlinck commented 1 month ago

Hello @JordiMForgeFlow

JordiMForgeFlow commented 1 month ago

@nilshamerlinck with my changes I keep retuning file names. What I have noticed is that the method _findfiles is returning relative paths instead of full paths, so without my changes when doing p[pending_path_len:] the file name is getting messed up.

In my first comment in this PR I am showing where I saw this happening for SFTP.

nilshamerlinck commented 1 month ago

HI @JordiMForgeFlow

JordiMForgeFlow commented 1 month ago

@nilshamerlinck I have the following config:

storage's directory_path: empty backend's input_dir_pending: input SFTP server name/version: Version 3

In my case, the method find_files is returning /file.name instead of input/file.name

nilshamerlinck commented 1 month ago

thanks @JordiMForgeFlow I will take it into account sorry, a couple more questions:

JordiMForgeFlow commented 1 month ago

@nilshamerlinck no problem, thank you for looking into it :)