rails_error_dashboard 0.11.8 → 0.11.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8f2e404fb451057a68a9210eaf1035282a061b1e9cdf1ad22f9831d6c85974a
4
- data.tar.gz: cd2feb750eb08095785468bdaef7cc5968e197482f735f7b529d971029a12223
3
+ metadata.gz: f07dcfe9569e107c4f8b3bee4f15e106c4b537690d9bf002af887e832d9e0a9b
4
+ data.tar.gz: 5defe92b8156a8564a6a1286d2e5199b450b2f6ca894bcafd65586fe3723a7e0
5
5
  SHA512:
6
- metadata.gz: 5d320b2ab1fa0d4ff60f469d1cc895c52c78645c217a85baf776438b116fdac046b6c9c96645bfea7fb0d6874f0a139028613cecf9d5b7891ef8efa786323888
7
- data.tar.gz: 82edc71f3850c9d75d8e40afdf9839ad79446537f4334c6c998acce167dcf7ffeccc4863b89f8165263cf4468ce9cba948d802eb9085fa3c6414d046095013a1
6
+ metadata.gz: 0fe0f1b0894c8c1c797e341b2e00d2120871dca2bcc2800527f69a99831cd700005f21245b6a3a0fef86f0c7466ec0e1f588e21cb503c8c3621f9d203c79ce4c
7
+ data.tar.gz: ba3e9269169d059eeab3cf3f469294ac520a9144558199c05e0dc0b5262b7bbbd0ec8a28896f15fd26ee5a605ed74f5707eae7e38a354160341b676cbe9d7d58
@@ -6,8 +6,8 @@ module RailsErrorDashboard
6
6
  include Concerns::LocalizedJob
7
7
 
8
8
  # CRITICAL: Ensure job failures don't break the app or spam error logs
9
- # Retry failed jobs with exponential backoff, but limit attempts
10
- retry_on StandardError, wait: :exponentially_longer, attempts: 3
9
+ # Retry failed jobs with polynomial backoff, but limit attempts
10
+ retry_on StandardError, wait: :polynomially_longer, attempts: 3
11
11
 
12
12
  # Global exception handling for all dashboard jobs
13
13
  rescue_from StandardError do |exception|
@@ -420,9 +420,10 @@ RailsErrorDashboard.configure do |config|
420
420
  # config.crash_capture_path = "/tmp/my_app_crashes"
421
421
 
422
422
  <% end -%>
423
- # Repository settings (auto-detected from git remote, optional override)
424
- # config.repository_url = ENV["REPOSITORY_URL"] # e.g., "https://github.com/user/repo"
425
- # config.repository_branch = ENV.fetch("REPOSITORY_BRANCH", "main") # Default branch
423
+ # "View Source" links need config.git_repository_url (set under Enhanced
424
+ # metrics below); nothing is auto-detected from the git remote.
425
+ # Which ref the links point at:
426
+ # config.git_branch_strategy = :commit_sha # :commit_sha (default), :current_branch, or :main
426
427
 
427
428
  # ============================================================================
428
429
  # INTERNAL LOGGING (Silent by Default)
@@ -15,6 +15,11 @@ module RailsErrorDashboard
15
15
  # generator.generate_link
16
16
  # # => "https://github.com/user/repo/blob/abc123def456/app/models/user.rb#L42"
17
17
  class GithubLinkGenerator
18
+ # The generated link is an href handed to every dashboard user, so only
19
+ # web URLs are ever linked. javascript:, data: and scp-style git@ forms
20
+ # produce no link even though the value comes from deployer configuration.
21
+ ALLOWED_SCHEMES = %w[http https].freeze
22
+
18
23
  attr_reader :repository_url, :file_path, :line_number, :commit_sha, :branch, :error
19
24
 
20
25
  # Initialize a new link generator
@@ -42,6 +47,11 @@ module RailsErrorDashboard
42
47
  # Normalize repository URL
43
48
  normalized_repo = normalize_repository_url
44
49
 
50
+ unless repository_host
51
+ @error = "Unsupported repository URL scheme: only http and https URLs are linked"
52
+ return nil
53
+ end
54
+
45
55
  # Determine reference (commit SHA or branch)
46
56
  reference = determine_reference
47
57
 
@@ -77,16 +87,33 @@ module RailsErrorDashboard
77
87
  url
78
88
  end
79
89
 
80
- # Detect repository type from URL
90
+ # Host of the repository URL, downcased, or nil when the value is not an
91
+ # http(s) URL with a host.
92
+ #
93
+ # @return [String, nil]
94
+ def repository_host
95
+ uri = URI.parse(normalize_repository_url)
96
+ return nil unless ALLOWED_SCHEMES.include?(uri.scheme.to_s.downcase) && uri.host.present?
97
+
98
+ uri.host.downcase
99
+ rescue URI::InvalidURIError
100
+ nil
101
+ end
102
+
103
+ # Detect repository type from the URL's host. Only the host is consulted,
104
+ # so "github.com" appearing in a path, query string or userinfo does not
105
+ # count. Self-hosted GitLab, Bitbucket, Gitea and Forgejo instances are
106
+ # recognised by their conventional subdomain ("gitlab.example.com").
81
107
  #
82
108
  # @return [Symbol] :github, :gitlab, :bitbucket, :codeberg, or :unknown
83
109
  def detect_repository_type
84
- normalized = normalize_repository_url.downcase
110
+ host = repository_host
111
+ return :unknown unless host
85
112
 
86
- return :github if normalized.include?("github.com")
87
- return :gitlab if normalized.include?("gitlab.com") || normalized.include?("gitlab.")
88
- return :bitbucket if normalized.include?("bitbucket.org") || normalized.include?("bitbucket.")
89
- return :codeberg if normalized.include?("codeberg.org") || normalized.include?("gitea.") || normalized.include?("forgejo.")
113
+ return :github if host == "github.com" || host.end_with?(".github.com")
114
+ return :gitlab if host == "gitlab.com" || host.include?("gitlab.")
115
+ return :bitbucket if host == "bitbucket.org" || host.include?("bitbucket.")
116
+ return :codeberg if host == "codeberg.org" || host.include?("gitea.") || host.include?("forgejo.")
90
117
 
91
118
  :unknown
92
119
  end
@@ -1,3 +1,3 @@
1
1
  module RailsErrorDashboard
2
- VERSION = "0.11.8"
2
+ VERSION = "0.11.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_error_dashboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.8
4
+ version: 0.11.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anjan Jagirdar
@@ -579,7 +579,7 @@ metadata:
579
579
  funding_uri: https://github.com/sponsors/AnjanJ
580
580
  post_install_message: |
581
581
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
582
- RED (Rails Error Dashboard) v0.11.8
582
+ RED (Rails Error Dashboard) v0.11.9
583
583
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
584
584
 
585
585
  First install: