Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

UrlParser: leading slash in path duplicates app name in RTMP stream name

Đang mở Phù hợp với người mới
#2,224 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
kotlin
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu bằng cách tìm UrlParser và đọc getAppName(), getFullPath() và getStreamName() để xác nhận dấu gạch chéo ở đầu ảnh hưởng thế nào đến cách xử lý đường dẫn của chúng. Thêm trường hợp dấu gạch chéo ở đầu được cung cấp làm kiểm thử đơn vị và kiểm tra rằng app là live/icu và stream là user; công việc hoàn tất khi các giá trị đã phân tích tạo ra đường dẫn được xuất bản như mong đợi live/icu/user.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Library version: 2.6.x – 2.8.1 (also current master). Not present in 2.5.5.

Description
When the RTMP URL path starts with an extra slash (e.g. rtmp://host:1935//live/icu/user), getAppName() and getStreamName() disagree on the path. getAppName() filters out empty segments and returns live/icu, but getStreamName() calls getFullPath().removePrefix(getAppName()) on the raw path /live/icu/user. The prefix does not match because of the leading slash, so the stream name keeps the whole path.

The server then receives app live/icu + stream live/icu/user, i.e. the published path becomes live/icu/live/icu/user. The same happens with a two-segment path: //live/user → live/live/user.

How it was found
OpenTAK ICU 1.6.0 (RootEncoder 2.6.7) publishing RTMPS to MediaMTX with path /live/icu/<user> fails. OpenTAK ICU 1.5.4 (RootEncoder 2.5.5) works with the same settings: there the result was app /live, stream icu/user. Verified on device: removing the leading slash from the path makes 1.6.0 work.

Steps to reproduce (unit test)

@Test
fun testLeadingSlashInPath() {
  val parser = UrlParser.parse("rtmp://localhost:1935//live/icu/user", arrayOf("rtmp"))
  assertEquals("live/icu", parser.getAppName())
  assertEquals("user", parser.getStreamName())   // actual: "live/icu/user"
}

Expected: stream name user, published path live/icu/user.
Actual: stream name live/icu/user, published path live/icu/live/icu/user.

Suggested fix
Normalize the path once in init, e.g. path = uri.rawPath.trimStart('/'), or derive the stream name from the same filtered segments that getAppName() uses, so both functions always see the same path.

Ngôn ngữ chính
Kotlin
Star
3k
Fork
946
Merge trung bình
3 ngày 17 giờ
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pedroSG94/RootEncoder

Tất cả issue của pedroSG94/RootEncoder

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.