mirror of
https://github.com/beilunyang/moemail.git
synced 2026-05-10 17:43:06 +08:00
feat: Email addresses are not case sensitive
This commit is contained in:
@@ -57,7 +57,7 @@ export async function POST(request: Request) {
|
||||
|
||||
const address = `${name || nanoid(8)}@${domain}`
|
||||
const existingEmail = await db.query.emails.findFirst({
|
||||
where: eq(emails.address, address)
|
||||
where: eq(sql`LOWER(${emails.address})`, address.toLowerCase())
|
||||
})
|
||||
|
||||
if (existingEmail) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Env } from '../types'
|
||||
import { drizzle } from 'drizzle-orm/d1'
|
||||
import { messages, emails, webhooks } from '../app/lib/schema'
|
||||
import { eq } from 'drizzle-orm'
|
||||
import { eq, sql } from 'drizzle-orm'
|
||||
import PostalMime from 'postal-mime'
|
||||
import { WEBHOOK_CONFIG } from '../app/config/webhook'
|
||||
import { EmailMessage } from '../app/lib/webhook'
|
||||
@@ -15,7 +15,7 @@ const handleEmail = async (message: ForwardableEmailMessage, env: Env) => {
|
||||
|
||||
try {
|
||||
const targetEmail = await db.query.emails.findFirst({
|
||||
where: eq(emails.address, message.to)
|
||||
where: eq(sql`LOWER(${emails.address})`, message.to.toLowerCase())
|
||||
})
|
||||
|
||||
if (!targetEmail) {
|
||||
|
||||
Reference in New Issue
Block a user