Fix sort path bug

- Fixed a bug that caused unset short_path variable to crash the server
- Touched up .env file
This commit is contained in:
Daniel Szabo 2023-07-01 20:49:55 +03:00
parent eda06a8df7
commit 8c18e423a3
2 changed files with 6 additions and 4 deletions

6
.env
View file

@ -74,9 +74,9 @@ export MICROBIN_HIGHLIGHTSYNTAX=true
export MICROBIN_PORT=8080 export MICROBIN_PORT=8080
# Sets the bind address for the server will be listening on. # Sets the bind address for the server will be listening on.
# Both ipv4 and ipv6 are supported. Default value: 0.0.0.0. # Both ipv4 and ipv6 are supported. Default value: "0.0.0.0".
# Example value: "myserver.net", "127.0.0.1". # Example value: "myserver.net", "127.0.0.1".
export MICROBIN_BIND=0.0.0.0 export MICROBIN_BIND="0.0.0.0"
# Enables private pastas. Adds a new checkbox to make your # Enables private pastas. Adds a new checkbox to make your
# pasta private, which then won't show up on the pastalist # pasta private, which then won't show up on the pastalist
@ -151,7 +151,7 @@ export MICROBIN_DEFAULT_BURN_AFTER=0
export MICROBIN_WIDE=false export MICROBIN_WIDE=false
# Enables generating QR codes for pastas. Requires # Enables generating QR codes for pastas. Requires
# --public-path to be set. # the public path to also be set.
# Default value: false # Default value: false
export MICROBIN_QR=true export MICROBIN_QR=true

View file

@ -142,8 +142,10 @@ impl Args {
} }
pub fn short_path_as_str(&self) -> String { pub fn short_path_as_str(&self) -> String {
if self.public_path.is_some() { if self.short_path.is_some() {
self.short_path.as_ref().unwrap().to_string() self.short_path.as_ref().unwrap().to_string()
} else if self.public_path.is_some() {
self.public_path.as_ref().unwrap().to_string()
} else { } else {
String::from("") String::from("")
} }