Skip to content

Commit 3e9ccd3

Browse files
committed
🐛 That was dumb
1 parent df93565 commit 3e9ccd3

File tree

6 files changed

+65
-12
lines changed

6 files changed

+65
-12
lines changed

ingestors/manager.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,12 @@ def auction(self, file_path, entity) -> type[Ingestor]:
164164
if score > best_score:
165165
best_score = score
166166
best_cls = cls
167-
168-
settings = Settings()
169-
if settings.tika_fallback:
170-
best_cls = TikaIngestor
171-
172167
if best_cls is None:
173-
raise ProcessingException("Format not supported")
168+
settings = Settings()
169+
if settings.tika_fallback:
170+
best_cls = TikaIngestor
171+
else:
172+
raise ProcessingException("Format not supported")
174173
return best_cls
175174

176175
def queue_entity(self, entity):

ingestors/misc/tika.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def extract_mimetype(result: dict[str, Any]) -> str | None:
1616

1717

1818
class TikaIngestor(Ingestor, TikaSupport):
19-
SCORE = 1
19+
SCORE = -1
2020

2121
def ingest(self, file_path: str, entity: EntityProxy):
2222
with open(file_path, "rb") as fh:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ svg = "ingestors.media.svg:SVGIngestor"
8888
audio = "ingestors.media.audio:AudioIngestor"
8989
video = "ingestors.media.video:VideoIngestor"
9090
json = "ingestors.misc.jsonfile:JSONIngestor"
91-
tika = "ingestors.misc.tika:TikaIngestor"
9291

9392
[project.optional-dependencies]
9493
ocr = ["tesserocr (==2.6.2)"]

tests/fixtures/script.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/fixtures/translate.po

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright (C) 2016 WP Rocket
2+
# This file is distributed under the same license as the WP Rocket package.
3+
# Translators:
4+
# Vasilis Manthos <vasilis@wp-media.me>, 2019
5+
#
6+
#, fuzzy
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: WP Rocket 3.3.7\n"
10+
"Report-Msgid-Bugs-To: http://wp-rocket.me/\n"
11+
"POT-Creation-Date: 2019-08-26 11:14-0400\n"
12+
"PO-Revision-Date: 2019-08-26 15:14+0000\n"
13+
"Language-Team: Greek (https://www.transifex.com/wp-media/teams/18133/el/)\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: 8bit\n"
17+
"Language: el\n"
18+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
19+
"X-Generator: Poedit 1.8.11\n"
20+
"X-Poedit-Basepath: ..\n"
21+
"X-Poedit-KeywordsList: __;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c\n"
22+
"X-Poedit-SearchPath-0: .\n"
23+
"X-Poedit-SearchPathExcluded-0: assets\n"
24+
"X-Poedit-SearchPathExcluded-1: src\n"
25+
"X-Poedit-SearchPathExcluded-2: vendor\n"
26+
"X-Poedit-SearchPathExcluded-3: node_modules\n"
27+
"X-Poedit-SearchPathExcluded-4: tests\n"
28+
"X-Poedit-SourceCharset: UTF-8\n"
29+
"X-Textdomain-Support: yes\n"
30+
31+
#: inc/3rd-party/hosting/flywheel.php:15 inc/3rd-party/hosting/godaddy.php:15
32+
#: inc/3rd-party/hosting/o2switch.php:15
33+
#: inc/3rd-party/hosting/pressidium.php:15 inc/3rd-party/hosting/savvii.php:15
34+
#: inc/3rd-party/hosting/wp-serveur.php:24
35+
#: inc/3rd-party/hosting/wpengine.php:15
36+
#, php-format
37+
msgid ""
38+
"Your site is hosted on %s, we have enabled Varnish auto-purge for "
39+
"compatibility."
40+
msgstr ""
41+
"Το site σας φιλοξενείται στο %s. Έχουμε ενεργοποιήσει τον αυτόματο καθαρισμό"
42+
" του Varnish για λόγους συμβατότητας."
43+
44+
#: inc/3rd-party/hosting/kinsta.php:150
45+
#, php-format
46+
msgid ""
47+
"Your installation seems to be missing core Kinsta files managing Cache "
48+
"clearing and CDN, which will prevent your Kinsta installation and WP Rocket "
49+
"from working correctly. Please get in touch with Kinsta support through your"
50+
" %1$sMyKinsta%2$s account to resolve this issue."
51+
msgstr ""
52+
"Φαίνεται ότι από την εγκατάστασή σας απουσιάζουν βασικά αρχεία για τη "
53+
"διαχείριση της εκκαθάρισης της Cache και του CDN. Αυτό θα εμποδίσει την "
54+
"ταυτόχρονη λειτουργία του WP Rocket με την εγκατάστασή σας στο Kinsta. "
55+
"Παρακαλώ, επικοινωνήστε με την υποστήριξη του Kinsta μέσω του "
56+
"%1$sMykinsta%2$s λογαριασμού σας, για να επιλύσετε αυτό το πρόβλημα."

tests/test_tika.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
class TikaIngestorTest(TestCase):
66
def test_match(self):
7-
fixture_path, entity = self.fixture("script.py")
7+
fixture_path, entity = self.fixture("translate.po")
88
assert self.manager.auction(fixture_path, entity) == TikaIngestor
99

1010
def test_ingest(self):
11-
fixture_path, entity = self.fixture("script.py")
11+
fixture_path, entity = self.fixture("translate.po")
1212
self.manager.ingest(fixture_path, entity)
1313
entity = self.get_emitted()[0]
14-
assert entity.first("bodyText") == 'print("hello world")'
14+
assert entity.first("bodyText").startswith("# Copyright")

0 commit comments

Comments
 (0)