bolcom / libunftp

Extensible, async, cloud orientated FTP(S) server library and the core of unFTP: https://github.com/bolcom/unFTP. Follow up and talk to us on https://t.me/unftp
Apache License 2.0
182 stars 33 forks source link

Add full path to event message #447

Open robklg opened 1 year ago

robklg commented 1 year ago

Problem When an event like PUT happens, a message can be sent to Pub/Sub. This message contains a path, but the path is relative to the virtual root of that user. There are use cases where the full path is desired. This applies to all storage backends.

Solution Add a field that contains the entire path. Optionally (in case of GCS) add a URL to the object.

joostderuijter commented 11 months ago

I'll take a look at this 👀

joostderuijter commented 11 months ago

@robklg Should we only include this additional field for Put events? I believe the use case from the feature request was for uploading a file, but I think it would be nice to also add it to all other DataEvent types that currently return a relative path. Which would be these ( not including Put ):

Got { path: String },
Deleted { path: String },
MadeDir { path: String },
RemovedDir { path: String },
robklg commented 11 months ago

Hi @joostderuijter, yes, for any operation on an object, basically any event that currently has a relative path, add the object's full path.

From what I remember in earlier conversations, the change would need to be applied to ControlChanMsg as well. And we should add a field, something like realpath. It would be generic over storage backends, and would be specific to each backend. For instance, for GCS it would give https://storage.google.com/object/bucket/something, and for regular filesystem /var/lib/ftproot/userdir/something