File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -113,12 +113,12 @@ static URL_PREFIX: GILOnceCell<String> = GILOnceCell::new();
113
113
114
114
fn get_url_prefix ( py : Python , include_url : bool ) -> Option < & str > {
115
115
if include_url {
116
- Some ( URL_PREFIX . get_or_init ( py , || {
117
- format ! (
118
- "https://errors.pydantic.dev/{}/v/" ,
119
- get_pydantic_version ( py ) . unwrap_or ( "latest" )
120
- )
121
- } ) )
116
+ let pydantic_version = match get_pydantic_version ( py ) {
117
+ // include major and minor version only
118
+ Some ( value ) => value . split ( "." ) . collect :: < Vec < & str > > ( ) [ .. 2 ] . join ( "." ) ,
119
+ None => "latest" . to_string ( ) ,
120
+ } ;
121
+ Some ( URL_PREFIX . get_or_init ( py , || format ! ( "https://errors.pydantic.dev/{pydantic_version}/v/" ) ) )
122
122
} else {
123
123
None
124
124
}
Original file line number Diff line number Diff line change @@ -128,7 +128,8 @@ def pydantic_version():
128
128
try :
129
129
import pydantic
130
130
131
- return pydantic .__version__
131
+ # include major and minor version only
132
+ return '.' .join (pydantic .__version__ .split ('.' )[:2 ])
132
133
except ImportError :
133
134
return 'latest'
134
135
You can’t perform that action at this time.
0 commit comments