* Add aggregate size and depth limits to archive and Slack import extraction - Add ExtractionBudget to docextractor interface; thread shared byte budget and max depth through all extractors so nested archives share one pool - Cap archive walk at 1000 entries per level and maxArchiveDepth levels - Cap Slack import at 500MB total decompressed across all ZIP entries * Add depth-limit and aggregate-size tests Add TestArchiveExtractorDepthLimit to verify that nested archive extraction stops at maxDepth levels. Add TestSlackImportTotalSizeLimit to verify that the aggregate byte cap halts Slack import entry processing once the limit is reached. Convert slackImportMaxTotalSize from const to var so tests can lower the threshold without creating multi-hundred-megabyte fixtures. * Cap subtext to remaining budget before appending * Restore Ctx field in ExtractSettings for API compatibility * Honor caller context cancellation in extractWithTimeout ExtractSettings.Ctx was restored for API compatibility but was never observed by extractWithTimeout. A cancelled request context could wait for the full extraction timeout (or forever when Timeout <= 0). Now, when Ctx is set, extractWithTimeout runs on a goroutine and selects on resultCh, timer.C (if Timeout > 0), and ctx.Done() — returning a cancellation error as soon as the caller context is cancelled. A nil channel for timer.C means the timeout case simply never fires when Timeout <= 0. The fast synchronous path is retained for the common case where neither Ctx nor Timeout is set. Adds TestExtractContextCancellation covering: already-cancelled context, mid-extraction cancellation, and ctx vs timeout race (ctx wins first). * Update pdf.go to use github.com/mattermost/pdf fork The go.mod was updated upstream to replace github.com/ledongthuc/pdf with the Mattermost fork github.com/mattermost/pdf. The pdf.go import was not updated during the rebase because git kept our version of the file. Also pass context.Background() to GetPlainText, which the fork extended to take a context.Context. * Don't log archive entry path in extraction error Entry paths from user-uploaded archives should not appear in error messages, per the pattern established in #37987. * Restore ctx to Extractor interface alongside budget Adds context.Context back as the first parameter to Extractor.Extract, alongside the existing ExtractionBudget parameter. This restores Alejandro's MM-69725 fix: pdfExtractor passes the context down to GetPlainText(ctx), so when extractWithTimeout returns (timeout or parent cancellation), the derived context is cancelled and the PDF goroutine stops at the next page rather than running to completion. mmPreviewExtractor also gains context propagation via http.NewRequestWithContext so its outbound HTTP call can be cancelled. Context-unaware extractors (document, plain) accept and ignore it. * Fix test extractors to implement updated Extractor interface * Fix remaining test extractors to implement updated Extractor interface --------- Co-authored-by: Edgar <edgar.bellotmico@mattermost.com>
Mattermost is an open core, self-hosted collaboration platform that offers chat, workflow automation, voice calling, screen sharing, and AI integration. This repo is the primary source for core development on the Mattermost platform; it's written in Go and React, runs as a single Linux binary, and relies on PostgreSQL. A new compiled version is released under an MIT license every month on the 16th.
Deploy Mattermost on-premises, or try it for free in the cloud.
Learn more about the following use cases with Mattermost:
Other useful resources:
- Download and Install Mattermost - Install, setup, and configure your own Mattermost instance.
- Product documentation - Learn how to run a Mattermost instance and take advantage of all the features.
- Developer documentation - Contribute code to Mattermost or build an integration via APIs, Webhooks, slash commands, Apps, and plugins.
Table of contents
- Install Mattermost
- Native mobile and desktop apps
- Get security bulletins
- Get involved
- Learn more
- License
- Get the latest news
- Contributing
Install Mattermost
- Download and Install Mattermost Self-Hosted - Deploy a Mattermost Self-hosted instance in minutes via Docker, Ubuntu, or tar.
- Get started in the cloud to try Mattermost today.
- Developer machine setup - Follow this guide if you want to write code for Mattermost.
Other install guides:
- Deploy Mattermost on Docker
- Mattermost Omnibus
- Install Mattermost from Tar
- Ubuntu 20.04 LTS
- Kubernetes
- Helm
- More server install guides
Native mobile and desktop apps
In addition to the web interface, you can also download Mattermost clients for Android, iOS, Windows PC, macOS, and Linux.
Get security bulletins
Receive notifications of critical security updates. The sophistication of online attackers is perpetually increasing. If you're deploying Mattermost it's highly recommended you subscribe to the Mattermost Security Bulletin mailing list for updates on critical security releases.
Get involved
- Contribute to Mattermost
- Find "Help Wanted" projects
- Join Developer Discussion on a Mattermost server for contributors
- Get Help With Mattermost
Learn more
- API options - webhooks, slash commands, drivers, and web service
- See who's using Mattermost
- Browse over 700 Mattermost integrations
License
See the LICENSE file for license rights and limitations.
Get the latest news
- X - Follow Mattermost on X, formerly Twitter.
- Blog - Get the latest updates from the Mattermost blog.
- Facebook - Follow Mattermost on Facebook.
- LinkedIn - Follow Mattermost on LinkedIn.
- Email - Subscribe to our newsletter (1 or 2 per month).
- Mattermost - Join the ~contributors channel on the Mattermost Community Server.
- IRC - Join the #matterbridge channel on Freenode (thanks to matterircd).
- YouTube - Subscribe to Mattermost.
Contributing
Please see CONTRIBUTING.md. Join the Mattermost Contributors server to join community discussions about contributions, development, and more.




