Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
ff841b73
Unverified
Commit
ff841b73
authored
3 years ago
by
hamidreza kalbasi
Committed by
Timo Kösters
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
use .keys() and remove unneccery .to_vec()
parent
80410547
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/database.rs
+1
-1
1 addition, 1 deletion
src/database.rs
src/database/media.rs
+3
-3
3 additions, 3 deletions
src/database/media.rs
with
4 additions
and
4 deletions
src/database.rs
+
1
−
1
View file @
ff841b73
...
...
@@ -16,7 +16,7 @@
use
crate
::{
utils
,
Error
,
Result
};
use
abstraction
::
DatabaseEngine
;
use
directories
::
ProjectDirs
;
use
log
::
{
error
,
info
}
;
use
log
::
error
;
use
rocket
::
futures
::{
channel
::
mpsc
,
stream
::
FuturesUnordered
,
StreamExt
};
use
ruma
::{
DeviceId
,
ServerName
,
UserId
};
use
serde
::
Deserialize
;
...
...
This diff is collapsed.
Click to expand it.
src/database/media.rs
+
3
−
3
View file @
ff841b73
...
...
@@ -108,7 +108,7 @@ pub async fn get(&self, globals: &Globals, mxc: &str) -> Result<Option<FileMeta>
let
mut
iter
=
self
.mediaid_file
.scan_prefix
(
prefix
);
if
let
Some
((
key
,
_
))
=
iter
.next
()
{
let
path
=
globals
.get_media_file
(
&
key
.to_vec
()
);
let
path
=
globals
.get_media_file
(
&
key
);
let
mut
file
=
vec!
[];
File
::
open
(
path
)
.await
?
.read_to_end
(
&
mut
file
)
.await
?
;
let
mut
parts
=
key
.rsplit
(|
&
b
|
b
==
0xff
);
...
...
@@ -197,7 +197,7 @@ pub async fn get_thumbnail(
if
let
Some
((
key
,
_
))
=
self
.mediaid_file
.scan_prefix
(
thumbnail_prefix
)
.next
()
{
// Using saved thumbnail
let
path
=
globals
.get_media_file
(
&
key
.to_vec
()
);
let
path
=
globals
.get_media_file
(
&
key
);
let
mut
file
=
vec!
[];
File
::
open
(
path
)
.await
?
.read_to_end
(
&
mut
file
)
.await
?
;
let
mut
parts
=
key
.rsplit
(|
&
b
|
b
==
0xff
);
...
...
@@ -232,7 +232,7 @@ pub async fn get_thumbnail(
}))
}
else
if
let
Some
((
key
,
_
))
=
self
.mediaid_file
.scan_prefix
(
original_prefix
)
.next
()
{
// Generate a thumbnail
let
path
=
globals
.get_media_file
(
&
key
.to_vec
()
);
let
path
=
globals
.get_media_file
(
&
key
);
let
mut
file
=
vec!
[];
File
::
open
(
path
)
.await
?
.read_to_end
(
&
mut
file
)
.await
?
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment