Repository: tauri-apps/tauri
File: crates/tauri/src/webview/mod.rs (Rust)

Code before:
      self,
      manager.state(),
      request.cmd.to_string(),
      request.body,
      request.headers,
    );

    let acl_origin = if is_local {
      Origin::Local
    } else {
      Origin::Remote {
        url: request.url.clone(),
      }
    };
    let window_label = message.webview.window_label();
    let (resolved_acl, has_app_acl_manifest) = {
      let runtime_authority = manager.runtime_authority.lock().unwrap();
      let acl = runtime_authority
        .resolve_access(
          &request.cmd,
          &window_label,
          message.webview.label(),
          &acl_origin,
        )
        .or_else(|| {
          if request.cmd.chars().any(|c| c.is_uppercase()) {
            // fallback to the snake case of the command
            // we do not do this by default for backwards compatibility
            runtime_authority.resolve_access(
              &if let Some((prefix, cmd_name)) = request.cmd.split_once('|') {
                format!("{prefix}|{}", heck::AsSnakeCase(cmd_name))
              } else {
                request.cmd.clone()
              },
              &window_label,
              message.webview.label(),
              &acl_origin,
            )
          } else {
            None
          }
        });
      (acl, runtime_authority.has_app_manifest())
    };

    let mut invoke = Invoke {
      message,
      resolver: resolver.clone(),
      acl: resolved_acl,
    };


Review comment (suggestion):
I honestly don't like this, it means we now match the commands in different casing without formal documentation, and that's confusing, I'd rather use a try catch call in the `addPluginListener` function

Code after:

        // on window and android, custom protocols are `http://<protocol-name>.path/to/route`
        // so we check using the first part of the domain
        #[cfg(any(windows, target_os = "android"))]
        let local = {
          let protocol_url = self.manager().protocol_url(uses_https);
          let maybe_protocol = current_url
            .domain()
            .and_then(|d| d .split_once('.'))
            .unwrap_or_default()
            .0;

          protocols.contains_key(maybe_protocol) && scheme == protocol_url.scheme()
        };

        local
      })
  }

  /// Handles this window receiving an [`InvokeRequest`].
  pub fn on_message(self, request: InvokeRequest, responder: Box<OwnedInvokeResponder<R>>) {
    let manager = self.manager_owned();
    let is_local = self.is_local_url(&request.url);

    // ensure the passed key matches what our manager should have injected
    let expected = manager.invoke_key();
    if request.invoke_key != expected {
      #[cfg(feature = "tracing")]
      tracing::error!(
        "__TAURI_INVOKE_KEY__ expected {expected} but received {}",
        request.invoke_key
      );

      #[cfg(not(feature = "tracing"))]
      eprintln!(
        "__TAURI_INVOKE_KEY__ expected {expected} but received {}",
        request.invoke_key
      );

      return;
    }

    let resolver = InvokeResolver::new(
      self.clone(),
      Arc::new(Mutex::new(Some(Box::new(
        move |webview: Webview<R>, cmd, response, callback, error| {
          responder(webview, cmd, response, callback, error);
        },
      )))),
      request.cmd.clone(),
      request.callback,