Skip to content

Add event handler support for file uploads and update dependencies#6

Merged
esavini merged 2 commits into
masterfrom
feature/size-command-should-call-fs-provider
May 18, 2026
Merged

Add event handler support for file uploads and update dependencies#6
esavini merged 2 commits into
masterfrom
feature/size-command-should-call-fs-provider

Conversation

@esavini

@esavini esavini commented May 18, 2026

Copy link
Copy Markdown
Member

This pull request introduces a new event handler system for the FTP server, allowing custom logic to be executed after file uploads. It adds the IFtpServerEventHandler interface, updates the server and dependency injection infrastructure to support event handlers, and ensures handlers are called after successful file uploads. The changes are designed to be extensible and maintainable, and include updates to tests and documentation.

Event Handler System:

  • Introduced the IFtpServerEventHandler interface in FmiSrl.FtpServer.Server.Abstractions, allowing developers to define custom logic for FTP server events, such as file uploads.
  • Modified the FtpCommandContext record to include an optional EventHandlers property, which holds the registered event handlers.
  • Updated the StorCommand to invoke all registered event handlers' OnFileUploadedAsync methods after a file is uploaded, with error logging for handler failures.

Dependency Injection and Server Construction:

  • Extended the IFtpServerBuilder interface and implementation to support registration of event handlers via the new AddEventHandler<TEventHandler>() method. [1] [2]
  • Updated the FtpServer class to accept and store event handlers, and to pass them into the FtpCommandContext during command execution. [1] [2] [3]

Documentation, Tests, and Miscellaneous:

  • Updated the integration test setup and the README to reflect the new constructor signature for FtpServer, which now requires event handlers as a parameter. [1] [2]
  • Bumped the project version to 1.3.0 and updated the required .NET SDK version in global.json. [1] [2]

esavini added 2 commits May 18, 2026 16:01
- Introduced `IFtpServerEventHandler` to handle server events.
- Updated `StorCommand` to invoke `OnFileUploadedAsync` on file upload.
- Enhanced dependency injection to register event handlers.
- Modified `README` and tests to include event handler configuration.
@esavini esavini merged commit 16e6e49 into master May 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant