Skip to content

Commit ab01122

Browse files
committed
ignore enclose size for RSS feeds that are probably torrent file sizes
1 parent 42731ea commit ab01122

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

core/src/com/biglybt/core/metasearch/impl/web/WebResult.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public void setAssetDate( String str ){
295295
assetDate = RSSUtils.parseRSSDate( str );
296296
}
297297

298-
public void setSizeFromHTML(String size) {
298+
public void setSizeFromHTML(String size, long minAcceptable) {
299299
if(size != null) {
300300
size = removeHTMLTags(size);
301301
String sizeS = Entities.HTML40.unescape(size).replace((char)160,(char)32);
@@ -318,7 +318,10 @@ public void setSizeFromHTML(String size) {
318318
if ( multiplier <= 0 ){
319319
multiplier= 1; // ignore invalid
320320
}
321-
this.size = (long) (base * multiplier );
321+
long result = (long) (base * multiplier );
322+
if ( result >= minAcceptable ){
323+
this.size = result;
324+
}
322325
} catch(Throwable e) {
323326
//e.printStackTrace();
324327
}

core/src/com/biglybt/core/metasearch/impl/web/json/JSONEngine.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@
477477
result.setNameFromHTML(fieldContent);
478478
break;
479479
case FIELD_SIZE :
480-
result.setSizeFromHTML(fieldContent);
480+
result.setSizeFromHTML(fieldContent, 0);
481481
break;
482482
case FIELD_PEERS :
483483
result.setNbPeersFromHTML(fieldContent);

core/src/com/biglybt/core/metasearch/impl/web/regex/RegexEngine.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@
447447
result.setNameFromHTML(fieldContent);
448448
break;
449449
case FIELD_SIZE :
450-
result.setSizeFromHTML(fieldContent);
450+
result.setSizeFromHTML(fieldContent, 0);
451451
break;
452452
case FIELD_PEERS :
453453
result.setNbPeersFromHTML(fieldContent);

core/src/com/biglybt/core/metasearch/impl/web/rss/RSSEngine.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,11 @@
410410

411411
if (lengthAtt != null){
412412

413-
result.setSizeFromHTML(lengthAtt.getValue());
413+
// The enclosure size is supposed to be that of the related content, i.e. the size of the
414+
// torrent file, NOT the size of the download
415+
// However historically it was used incorrectly to refer to the sie of the download itself.
416+
// So only accept it as such if the size is probably too large for a torrent file
417+
result.setSizeFromHTML(lengthAtt.getValue(), 1024*1024 );
414418
}
415419
}
416420
}else if(lc_child_name.equals( "category" )) {
@@ -535,7 +539,7 @@
535539
}
536540
}else if ( lc_full_child_name.equals( "vuze:size" )){
537541

538-
result.setSizeFromHTML( value );
542+
result.setSizeFromHTML( value, 0 );
539543

540544
}else if ( lc_full_child_name.equals( "vuze:seeds" )){
541545

@@ -745,7 +749,7 @@
745749
try{
746750
long l = Long.parseLong( n.getValue().trim());
747751

748-
result.setSizeFromHTML( l + " B" );
752+
result.setSizeFromHTML( l + " B", 0 );
749753

750754
}catch( Throwable e ){
751755

@@ -900,7 +904,7 @@
900904

901905
if ( n != null ){
902906

903-
result.setSizeFromHTML( n.getValue().trim());
907+
result.setSizeFromHTML( n.getValue().trim(), 0 );
904908
}
905909
}
906910

@@ -984,7 +988,7 @@
984988

985989
if ( desc_size != null ){
986990

987-
result.setSizeFromHTML( desc_size );
991+
result.setSizeFromHTML( desc_size, 0 );
988992

989993
}
990994
}

uis/src/com/biglybt/ui/swt/columns/searchsubs/ColumnSearchSubResultGrabbed.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void refresh(TableCell cell) {
5858
return;
5959
}
6060

61-
cell.setText( String.valueOf( num ));
61+
cell.setText( num<0?"":String.valueOf( num ));
6262

6363
return;
6464

0 commit comments

Comments
 (0)