Skip to content

Commit

Permalink
connect: fix 1.75 problems
Browse files Browse the repository at this point in the history
  • Loading branch information
photovoltex committed Nov 19, 2024
1 parent 6bd09ff commit 7be55c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions connect/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ impl ResolveContext {
// expected page_url: hm://artistplaycontext/v1/page/spotify/album/5LFzwirfFwBKXJQGfwmiMY/km_artist
pub fn from_page_url(page_url: String) -> Self {
let split = if let Some(rest) = page_url.strip_prefix("hm://") {
rest.split("/")
rest.split('/')
} else {
page_url.split("/")
page_url.split('/')
};

let uri = split
Expand Down
11 changes: 6 additions & 5 deletions connect/src/state/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,24 +216,25 @@ impl ConnectState {
) -> Result<ProvidedTrack, Error> {
let question_mark_idx = ctx_track
.uri
.contains("?")
.contains('?')
.then(|| ctx_track.uri.find('?'))
.flatten();

let ctx_track_uri = if let Some(idx) = question_mark_idx {
&ctx_track.uri[..idx].to_string()
&ctx_track.uri[..idx]
} else {
&ctx_track.uri
};
}
.to_string();

let provider = if self.unavailable_uri.contains(ctx_track_uri) {
let provider = if self.unavailable_uri.contains(&ctx_track_uri) {
Provider::Unavailable
} else {
provider.unwrap_or(Provider::Context)
};

let id = if !ctx_track_uri.is_empty() {
SpotifyId::from_uri(ctx_track_uri)
SpotifyId::from_uri(&ctx_track_uri)
} else if !ctx_track.gid.is_empty() {
SpotifyId::from_raw(&ctx_track.gid)
} else {
Expand Down
2 changes: 2 additions & 0 deletions core/src/spclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ component! {

pub type SpClientResult = Result<Bytes, Error>;

#[allow(clippy::declare_interior_mutable_const)]
pub const CLIENT_TOKEN: HeaderName = HeaderName::from_static("client-token");
#[allow(clippy::declare_interior_mutable_const)]
const CONNECTION_ID: HeaderName = HeaderName::from_static("x-spotify-connection-id");

#[derive(Debug, Error)]
Expand Down

0 comments on commit 7be55c9

Please sign in to comment.