Prefer Regexp#match? over String#match?
This commit fixes a minor regression introduced in the commit e10a909
Prefer using `Regexp#match` because `@file` or `file` in these lines
could be `nil` if the `tag_markup` is just whitespace. In that scenario,
Jekyll should proceed to the validation logic and bail instead of raising
a `NoMethodError` exception.
			
			
This commit is contained in:
		
							parent
							
								
									4c9cbad677
								
							
						
					
					
						commit
						ffe8d168f2
					
				|  | @ -164,7 +164,6 @@ | |||
|   * Update TestTags in sync with Rouge v3.4 (#7709) | ||||
|   * Bump RuboCop to v0.71.0 (#7687) | ||||
|   * Use regexp to filter special entries (#7702) | ||||
|   * Replace `String#=~` with `String#match?` (#7718) | ||||
|   * Reduce Array objects generated from utility method (#7749) | ||||
| 
 | ||||
| ### Documentation | ||||
|  |  | |||
|  | @ -54,7 +54,7 @@ module Jekyll | |||
|       end | ||||
| 
 | ||||
|       def validate_file_name(file) | ||||
|         if file.match?(INVALID_SEQUENCES) || !file.match?(VALID_FILENAME_CHARS) | ||||
|         if INVALID_SEQUENCES.match?(file) || !VALID_FILENAME_CHARS.match?(file) | ||||
|           raise ArgumentError, <<~MSG | ||||
|             Invalid syntax for include tag. File contains invalid characters or sequences: | ||||
| 
 | ||||
|  | @ -90,7 +90,7 @@ module Jekyll | |||
| 
 | ||||
|       # Render the variable if required | ||||
|       def render_variable(context) | ||||
|         Liquid::Template.parse(@file).render(context) if @file.match?(VARIABLE_SYNTAX) | ||||
|         Liquid::Template.parse(@file).render(context) if VARIABLE_SYNTAX.match?(@file) | ||||
|       end | ||||
| 
 | ||||
|       def tag_includes_dirs(context) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue