From a7892ae6a478b4364fb70e8697df3716da28e086 Mon Sep 17 00:00:00 2001 From: Ivan Kuchin Date: Wed, 8 Apr 2026 18:39:26 +0200 Subject: [PATCH] give name to work package short path --- config/routes.rb | 2 +- spec/routing/short_uri_wp_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index bbdbe14003a..9336c99219e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -67,7 +67,7 @@ Rails.application.routes.draw do get "/wp(/)" => redirect("#{rails_relative_url_root}/work_packages") get "/wp/*rest" => redirect { |params, _req| "#{rails_relative_url_root}/work_packages/#{URI::RFC2396_Parser.new.escape(params[:rest])}" - } + }, as: :work_package_short # Add catch method for Rack OmniAuth to allow route helpers # Note: This renders a 404 in rails but is caught by omniauth in Rack before diff --git a/spec/routing/short_uri_wp_spec.rb b/spec/routing/short_uri_wp_spec.rb index 49a58a3d551..3fd46876ad4 100644 --- a/spec/routing/short_uri_wp_spec.rb +++ b/spec/routing/short_uri_wp_spec.rb @@ -56,5 +56,10 @@ RSpec.describe "routes for old issue uris", type: :request do expect(last_response).to be_redirect expect(last_response.location).to end_with "/work_packages/1234" end + + it "has a path helper" do + expect(work_package_short_path("123")).to eq("/wp/123") + expect(work_package_short_path(%w[123 a_tab foo])).to eq("/wp/123/a_tab/foo") + end end end