Skip to content

Commit

Permalink
Fixed error in regex that detects noindex directives, and bumped Pyth…
Browse files Browse the repository at this point in the history
…on to 3.12 in CI/CD workflow (#109)

* bump Python to 3.12 in CI/CD workflow

* fix regex for meta robots noindex directive

* Update CHANGELOG.md
  • Loading branch information
cicirello authored Oct 5, 2023
1 parent d2826ca commit dcf0de7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'

- name: Run Python unit tests
run: python3 -u -m unittest tests/tests.py
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased] - 2023-09-22
## [Unreleased] - 2023-10-05

### Added

Expand All @@ -15,8 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

### Fixed
* Fix minor bug in regex used to detect if a page has a meta robots noindex directive in head.

### CI/CD
* Bump Python to 3.12 in CI/CD workflows when running unit tests.

### Dependencies
* Bump cicirello/pyaction from 4.14.1 to 4.24.0
Expand Down
2 changes: 1 addition & 1 deletion generatesitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def hasMetaRobotsNoindex(f) :
m = re.search("<body>", contents, flags=re.I)
all_meta_tags = RE_META_TAG.findall(contents, endpos=m.start()) if m else RE_META_TAG.findall(contents)
for tag in all_meta_tags :
if re.search("name\s*=\s*\"\s*robots", tag, flags=re.I) and re.search("content\s*=\s*\".*noindex", tag, flags=re.I) :
if re.search("name\\s*=\\s*\"\\s*robots", tag, flags=re.I) and re.search("content\\s*=\\s*\".*noindex", tag, flags=re.I) :
return True
return False
except OSError:
Expand Down

0 comments on commit dcf0de7

Please sign in to comment.