fix(output): do not slice pathname unless ends with `.txt` (#52640)
### What?
When using `output: "export"`, all URL pathnames are sliced.
### Why?
A regression was introduced at
https://github.com/vercel/next.js/pull/50974/files#diff-7b6239af735eba0c401e1a0db1a04dd4575c19a031934f02d128cf3ac813757bR76-R80
### How?
Check if a pathname ends with `.txt` before slicing the end.
Fixes #52381