Check-in [997fb1cff4]
Logged in as anonymous
Overview
Comment:remove lazy_static
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 997fb1cff4c2ef2e699a313b29eaedc0b28de2b78e40f5dfb307460e2ffa2295
User & Date: arcade on 2026-08-01 09:06:37.301
Other Links: manifest | tags
Context
2026-08-01
10:24
regex in get_id was defunct, fix regex, fix logic to filter unknown domains check-in: f748e99b70 user: arcade tags: trunk
09:06
remove lazy_static check-in: 997fb1cff4 user: arcade tags: trunk
2026-07-31
15:42
consolidate and clarify check-in: b9af445709 user: arcade tags: trunk
Changes
1
2
3




4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20







21
22
23
24
25
26
27
1
2

3
4
5
6
7
8

9
10
11
12
13
14
15
16
17





18
19
20
21
22
23
24
25
26
27
28
29
30
31


-
+
+
+
+


-









-
-
-
-
-
+
+
+
+
+
+
+







use crate::Cursor;

use std::borrow::Cow;
use std::{
	borrow::Cow,
	sync::LazyLock,
};

use html_escape::encode_text;
use lazy_static::lazy_static;
use regex::{
	Regex,
	RegexBuilder,
};
use stacked_errors::{
	bail,
	Result,
};

lazy_static! {
	pub static ref RE_DOMAIN: Regex = Regex::new(r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$").expect("Invalid domain regex");
	pub static ref RE_CLOSING: Regex = RegexBuilder::new(r"</[ \t]*(pre|code)[ \t]*>")
		.case_insensitive(true).build().expect("Invalid closing tag regex");
}
pub static RE_DOMAIN: LazyLock<Regex> = LazyLock::new(|| {
	Regex::new(r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$").expect("Invalid domain regex")
});
pub static RE_CLOSING: LazyLock<Regex> = LazyLock::new(|| {
	RegexBuilder::new(r"</[ \t]*(pre|code)[ \t]*>")
		.case_insensitive(true).build().expect("Invalid closing tag regex")
});

/// Stores binary attachment data and metadata for Telegram messages.
/// The data is wrapped in a `Cursor<Vec<u8>>` for efficient streaming,
/// while `name` holds the filename or display name of the attachment.
#[derive(Debug)]
pub struct Attachment {
	pub data: Cursor<Vec<u8>>,