[backend/masto-client] Fix invalid quotes on note create
This commit is contained in:
parent
21527547a2
commit
e14686ea8c
1 changed files with 9 additions and 6 deletions
|
@ -219,12 +219,15 @@ public class StatusController(
|
|||
|
||||
var lastToken = request.Text?.Split(' ').LastOrDefault();
|
||||
var quoteUri = lastToken?.StartsWith("https://") ?? false ? lastToken : null;
|
||||
var quote = lastToken?.StartsWith($"https://{config.Value.WebDomain}/notes/") ?? false
|
||||
? await db.Notes.IncludeCommonProperties()
|
||||
.FirstOrDefaultAsync(p => p.Id ==
|
||||
lastToken.Substring($"https://{config.Value.WebDomain}/notes/".Length))
|
||||
: await db.Notes.IncludeCommonProperties()
|
||||
.FirstOrDefaultAsync(p => p.Uri == quoteUri || p.Url == quoteUri);
|
||||
var quote = quoteUri != null
|
||||
? lastToken?.StartsWith($"https://{config.Value.WebDomain}/notes/") ?? false
|
||||
? await db.Notes.IncludeCommonProperties()
|
||||
.FirstOrDefaultAsync(p => p.Id ==
|
||||
lastToken.Substring($"https://{config.Value.WebDomain}/notes/"
|
||||
.Length))
|
||||
: await db.Notes.IncludeCommonProperties()
|
||||
.FirstOrDefaultAsync(p => p.Uri == quoteUri || p.Url == quoteUri)
|
||||
: null;
|
||||
|
||||
if (quote != null && quoteUri != null && request.Text != null)
|
||||
request.Text = request.Text[..(request.Text.Length - quoteUri.Length - 1)];
|
||||
|
|
Loading…
Add table
Reference in a new issue