mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
chore(repo): remove dead code and useless tests (#3375)
This commit is contained in:
1 parent
7e177a1c90
commit
1cd62eb661
1391 files changed
+783
-120415
No files matched your search
@@ -1,52 +1,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
use crate::{
|
||||
disposition::{self, Decision},
|
||||
http_headers,
|
||||
range::ByteRange,
|
||||
};
|
||||
use crate::{http_headers, range::ByteRange};
|
||||
use http::{HeaderMap, header};
|
||||
|
||||
fn disposition_string(decision: Decision, filename: Option<&str>) -> String {
|
||||
disposition::header(decision, filename)
|
||||
.expect("disposition header")
|
||||
.into_header_value()
|
||||
.to_str()
|
||||
.expect("disposition header is ascii")
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disposition_policy_blocks_scriptable_documents() {
|
||||
assert_eq!(disposition::decide("image/png", false), Decision::Inline);
|
||||
assert_eq!(
|
||||
disposition::decide("video/webm; codecs=vp9", false),
|
||||
Decision::Inline
|
||||
);
|
||||
assert_eq!(
|
||||
disposition::decide("image/svg+xml", false),
|
||||
Decision::Attachment
|
||||
);
|
||||
assert_eq!(
|
||||
disposition::decide("application/pdf; charset=binary", false),
|
||||
Decision::Attachment
|
||||
);
|
||||
assert_eq!(disposition::decide("image/png", true), Decision::Attachment);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn disposition_filename_uses_ascii_and_rfc5987_forms() {
|
||||
assert_eq!(
|
||||
disposition_string(Decision::Attachment, Some("photo.png")),
|
||||
"attachment; filename=\"photo.png\""
|
||||
);
|
||||
assert_eq!(
|
||||
disposition_string(Decision::Attachment, Some("résumé/\".png")),
|
||||
"attachment; filename=\"r__sum____.png\"; filename*=UTF-8''r%C3%A9sum%C3%A9%2F%22.png"
|
||||
);
|
||||
assert_eq!(disposition_string(Decision::Inline, Some("")), "inline");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn public_media_headers_never_negotiate_a_conditional_validator() {
|
||||
let mut responses = Vec::new();
|
||||
|
||||
Reference in new issue
Block a user